idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
56,400 | public function listBackup ( ) { $ this -> downloadListBackup ( ) ; $ this -> actionListBackup ( ) ; $ this -> setTitleListBackup ( ) ; $ this -> setBreadcrumbListBackup ( ) ; $ this -> setFilterListBackup ( ) ; $ this -> setPagerListBackup ( ) ; $ this -> setData ( 'backups' , $ this -> getListBackup ( ) ) ; $ this ->... | Displays the backup overview page |
56,401 | protected function downloadListBackup ( ) { $ backup_id = $ this -> getQuery ( 'download' ) ; if ( empty ( $ backup_id ) ) { return null ; } $ this -> controlAccess ( 'backup_download' ) ; $ backup = $ this -> backup -> get ( $ backup_id ) ; if ( ! empty ( $ backup [ 'path' ] ) ) { $ this -> download ( gplcart_file_abs... | Downloads a backup |
56,402 | protected function actionListBackup ( ) { list ( $ selected , $ action ) = $ this -> getPostedAction ( ) ; $ deleted = 0 ; foreach ( $ selected as $ id ) { if ( $ action === 'delete' && $ this -> access ( 'backup_delete' ) ) { $ deleted += ( int ) $ this -> backup -> delete ( $ id ) ; } } if ( $ deleted > 0 ) { $ messa... | Applies an action to the selected backups |
56,403 | protected function getListBackup ( ) { $ options = $ this -> query_filter ; $ options [ 'limit' ] = $ this -> data_limit ; return $ this -> backup -> getList ( $ options ) ; } | Returns an array of backups |
56,404 | public function setImage ( $ image ) { if ( false === is_string ( $ image ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ image ) ) , E_USER_ERROR ) ; } $ file = new File ( $ image ) ; if ( false === $ file -> exists ( ) ) { return tri... | Set image by giving a file path as image |
56,405 | public function setFont ( $ font ) { if ( false === is_string ( $ font ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ font ) ) , E_USER_ERROR ) ; } $ file = new File ( $ font ) ; if ( false === $ file -> exists ( ) ) { return trigger_... | Set the font by giving a file path as font |
56,406 | public function setFontSize ( $ min , $ max = null ) { if ( false === ( '-' . intval ( $ min ) == '-' . $ min ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type integer, "%s" given' , __METHOD__ , gettype ( $ min ) ) , E_USER_ERROR ) ; } if ( null !== $ max && false === ( '-' . intval... | Set the fontsize min . and max . If no max . is set max . will be the same as min . |
56,407 | public function setAngle ( $ min , $ max = null ) { if ( false === ( '-' . intval ( $ min ) == '-' . $ min ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type integer, "%s" given' , __METHOD__ , gettype ( $ min ) ) , E_USER_ERROR ) ; } if ( null !== $ max && false === ( '-' . intval ( ... | Set the angle min . and max . If no max . is set max . will be the same as min . |
56,408 | public function matches ( $ name , $ pattern , & $ matches = [ ] ) { return preg_match ( $ pattern , $ this -> get ( $ name ) , $ matches ) ; } | Tests if the value of an attribute matches the given pattern . |
56,409 | public static function fromRgba ( int $ red , int $ green , int $ blue , float $ alpha ) : TransparentColour { return new self ( new Colour ( $ red , $ green , $ blue ) , $ alpha ) ; } | Creates a new colour from the supplied rgba values |
56,410 | public static function fromRgbaString ( string $ string ) : TransparentColour { list ( $ r , $ g , $ b , $ a ) = ColourStringParser :: parseRgbaString ( $ string ) ; return new self ( new Colour ( $ r , $ g , $ b ) , $ a ) ; } | Creates a new colour from the supplied rgba string value |
56,411 | public function toArray ( $ query ) { $ nodes = $ this -> xpath -> query ( ( string ) $ query ) ; if ( $ nodes -> length ) { $ result = array ( ) ; foreach ( $ nodes as $ node ) { $ result [ ] = json_decode ( json_encode ( simplexml_load_string ( $ this -> dom -> saveXML ( $ node ) ) ) , true ) ; } return $ result ; } ... | Extract an XPath query as an associative array |
56,412 | private static function recursiveImplode ( $ glue , $ pieces ) { if ( is_array ( $ pieces ) ) { $ strings = array ( ) ; foreach ( $ pieces as $ key => $ piece ) { if ( is_int ( $ key ) || $ key !== self :: ATTRIBUTES ) { if ( is_array ( $ piece ) ) { $ strings [ $ key ] = static :: recursiveImplode ( $ glue , $ piece )... | Recursively implode nested ArrayAccess |
56,413 | private static function DOMtoArray ( $ node ) { $ occurence = array ( ) ; $ result = null ; if ( $ node -> childNodes ) { foreach ( $ node -> childNodes as $ child ) { if ( isset ( $ occurence [ $ child -> nodeName ] ) ) { $ occurence [ $ child -> nodeName ] ++ ; } else { $ occurence [ $ child -> nodeName ] = 1 ; } } }... | Convert the XML DOM into a nested associative array |
56,414 | final public static function box ( $ plainValue ) : self { foreach ( static :: valueNames ( ) as $ name ) { if ( self :: constant ( $ name ) === $ plainValue ) { return self :: __callStatic ( $ name , [ ] ) ; } } $ message = sprintf ( 'Value %s is not within %s enumeration.' , $ plainValue , static :: class ) ; throw n... | Box the given plain value . |
56,415 | public static function valueNames ( ) : array { static $ valueNames = [ ] ; if ( ! isset ( $ valueNames [ static :: class ] ) ) { $ valueNames [ static :: class ] = [ ] ; foreach ( ( new ReflectionClass ( static :: class ) ) -> getReflectionConstants ( ) as $ reflectionConstant ) { if ( $ reflectionConstant -> isPublic... | Get names of all the values in this enumeration . |
56,416 | private static function instantiate ( string $ valueName ) : self { $ value = new static ( ... ( array ) self :: constant ( $ valueName ) ) ; $ value -> name = $ valueName ; return $ value ; } | Instantiate value with the given name . |
56,417 | private static function constant ( string $ name ) { $ constant = static :: class . '::' . $ name ; if ( ! defined ( $ constant ) ) { $ message = sprintf ( 'Enum %s does not contain value named %s.' , static :: class , $ name ) ; throw new InvalidArgumentException ( $ message ) ; } return constant ( $ constant ) ; } | Get the value of the given constant . |
56,418 | public function validateObject ( $ object ) { if ( ! $ object instanceof SerialisableObject ) { throw new ClassNotSerialisableException ( get_class ( $ object ) ) ; } $ classAnnotations = ClassAnnotationParser :: instance ( ) -> parse ( $ object ) ; $ validationFields = $ classAnnotations -> getFieldAnnotationsForMatch... | Validate a serialisable object |
56,419 | public function setCachePath ( string $ path ) { $ rpath = substr ( $ path , 0 , 6 ) === "vfs://" ? $ path : realpath ( $ path ) ; if ( empty ( $ rpath ) || ! file_exists ( $ path ) ) throw new InvalidArgumentException ( "Path does not exist: " . $ rpath ) ; $ this -> cache_path = $ rpath ; } | Set the base directory for the cache files |
56,420 | public function setHook ( ) { Hook :: subscribe ( Hook :: SHUTDOWN_HOOK , [ $ this , 'saveCacheHook' ] , 10 ) ; foreach ( $ this -> repository as $ name => $ cache ) $ this -> checkExpiry ( $ name ) ; } | Add the hook after the configuration has been loaded and apply invalidation to the cache once it times out . |
56,421 | public function unsetHook ( ) { if ( $ this -> hook_reference !== null ) { Hook :: unsubscribe ( Hook :: SHUTDOWN_HOOK , $ this -> hook_reference ) ; } } | Remove the hook - cancelling automatic save on termination |
56,422 | protected function loadCache ( string $ name ) { $ path = $ this -> cache_path ; $ cache_file = $ path . '/' . $ name . '.cache' ; if ( file_exists ( $ cache_file ) ) { if ( ! is_readable ( $ cache_file ) ) { self :: getLogger ( ) -> error ( "Cannot read cache from {0}" , [ $ cache_file ] ) ; } else { try { $ contents ... | Load the cache from the cache files . The data will be stored in the class - internal cache storage |
56,423 | public function getCache ( string $ name ) { if ( ! isset ( $ this -> repository [ $ name ] ) ) $ this -> loadCache ( $ name ) ; return new Cache ( $ name , $ this -> repository [ $ name ] ) ; } | Return a cache |
56,424 | protected function getStub ( $ name ) { if ( stripos ( $ name , '.php' ) === false ) $ name = $ name . '.php' ; $ this -> files -> get ( $ this -> getStubPath ( ) . '/' . $ name ) ; } | Get the given stub by name . |
56,425 | protected function parseStub ( $ stub , $ replacements = [ ] ) { $ output = $ stub ; foreach ( $ replacements as $ key => $ replacement ) { $ search = '{{' . $ key . '}}' ; $ output = str_replace ( $ search , $ replacement , $ output ) ; } return $ output ; } | Parse the provided stub and replace via the array given . |
56,426 | protected function getCommandArguments ( InputInterface $ input ) { $ package = $ this -> getPackageInformation ( $ input -> getOption ( 'package' ) ) ; return [ $ this -> getComposer ( ) , $ this -> composerOperation , $ package , ] ; } | Returns command arguments used in ProcessBuilder |
56,427 | protected function getPackageInformation ( $ id ) { $ package = $ this -> getContainer ( ) -> get ( 'package.repository' ) -> find ( $ id ) ; if ( ! $ package instanceof PackageInterface ) { throw new \ InvalidArgumentException ( sprintf ( 'Package "%s" not found' , $ id ) ) ; } return $ package -> getFullName ( ) ; } | Returns package information by identifier |
56,428 | protected function initializeServer ( LoopInterface $ loop , $ port ) { $ writer = new Stream ( "php://output" ) ; $ logger = new Logger ( ) ; $ logger -> addWriter ( $ writer ) ; return new WebSocketServer ( "tcp://0.0.0.0:{$port}" , $ loop , $ logger ) ; } | Initializes web - socket server |
56,429 | protected function addEnvironmentInfo ( $ port , $ command ) { $ translator = $ this -> getContainer ( ) -> get ( 'translator' ) ; $ info = [ $ translator -> trans ( 'environment.server.port' ) => $ port , $ translator -> trans ( 'environment.console.command' ) => $ command , $ translator -> trans ( 'environment.symfon... | Adds additional environment information to buffer |
56,430 | protected function broadcastToClients ( \ SplObjectStorage $ clients ) { foreach ( $ clients as $ client ) { $ client -> sendString ( $ this -> processOutput ( ) ) ; } } | Sends processed output to all connected clients |
56,431 | public function setSQL ( $ sql ) { if ( ( is_string ( $ sql ) && ( strlen ( $ sql ) <= 0 ) ) || ( ! is_string ( $ sql ) && ( $ sql !== null ) ) ) { throw SchemaException :: invalidViewSQL ( $ this -> getName ( ) ) ; } $ this -> sql = $ sql ; } | Sets the SQL query . |
56,432 | public function notFieldExpression ( FieldExpression $ expr , self $ compiler ) { $ not = new TreeExpression ( 'not' ) ; $ not -> addChild ( new FieldExpression ( $ expr -> getField ( ) , $ expr -> getValue ( ) ) ) ; return $ this -> notExpression ( $ not , $ compiler ) ; } | Delegate a not equal field expression to the previous map |
56,433 | public function phrasizeOrTermize ( $ value , $ phrase = true , $ escape = true ) { if ( ! $ phrase && ! $ escape ) return $ value ; if ( ! is_array ( $ value ) ) return $ phrase ? new PhraseExpression ( $ value ) : new TermExpression ( $ value ) ; $ ary = array ( ) ; foreach ( $ value as $ key => $ v ) { $ ary [ $ key... | Helper function that wraps an expression value with a phrase expression or a term expression Phrasing wins on termizing |
56,434 | public function getMainConfig ( ) { $ config = null ; if ( $ this -> cache ) { $ config = $ this -> cache -> fetch ( self :: CONFIG_CACHE_KEY ) ; } if ( empty ( $ config ) ) { $ config = $ this -> generateMainConfig ( ) ; if ( $ this -> cache ) { $ this -> cache -> save ( self :: CONFIG_CACHE_KEY , $ config ) ; } } ret... | Fetches piece of JS - code with require . js main config from cache or if it was not there - generates and put into a cache |
56,435 | public function generateMainConfig ( ) { $ requirejs = $ this -> collectConfigs ( ) ; $ config = $ requirejs [ 'config' ] ; if ( ! empty ( $ config [ 'paths' ] ) && is_array ( $ config [ 'paths' ] ) ) { foreach ( $ config [ 'paths' ] as & $ path ) { if ( is_array ( $ path ) ) { $ path = $ this -> generator -> generate ... | Generates main config for require . js |
56,436 | public function generateBuildConfig ( $ configPath ) { $ config = $ this -> collectConfigs ( ) ; $ config [ 'build' ] [ 'baseUrl' ] = './' ; $ config [ 'build' ] [ 'out' ] = './' . $ config [ 'build_path' ] ; $ config [ 'build' ] [ 'mainConfigFile' ] = './' . $ configPath ; $ paths = [ 'require-config' => './' . substr... | Generates build config for require . js |
56,437 | public function collectConfigs ( ) { if ( ! $ this -> collectedConfig ) { $ config = $ this -> config ; foreach ( $ this -> bundles as $ bundle ) { $ reflection = new \ ReflectionClass ( $ bundle ) ; if ( is_file ( $ file = dirname ( $ reflection -> getFileName ( ) ) . '/Resources/config/requirejs.yml' ) ) { $ bundleCo... | Goes across bundles and collects configurations |
56,438 | public static function get ( $ path , $ data = [ ] ) { ob_start ( ) ; extract ( $ data ) ; try { $ basePath = static :: getInstance ( ) -> basePath ; if ( $ basePath !== null ) { if ( mb_substr ( $ path , 0 , 1 ) === static :: DIRECTORY_SEPARATOR ) { $ path = mb_substr ( $ path , 1 ) ; } if ( mb_substr ( $ basePath , -... | Returns the view at the given path with the given data . |
56,439 | protected function doCount ( ) { $ query = $ this -> getCountQuery ( ) ; $ result = $ query -> execute ( ) -> fetchResult ( ) ; $ this -> count = intval ( $ result [ 'count' ] ) ; $ this -> pages = intval ( $ this -> count / $ this -> itemsPerPage ) ; if ( $ this -> count % $ this -> itemsPerPage != 0 ) { $ this -> pag... | Does the count for all records |
56,440 | public function getOption ( string $ key ) : Option { if ( ! $ this -> has ( $ key ) ) { throw UnknownOptionKey :: fromKey ( $ key ) ; } return $ this -> map [ $ key ] [ self :: SUBKEY_OPTION ] ; } | Get the associated option for a specific key . |
56,441 | public function getRepository ( string $ key ) : OptionRepository { if ( ! $ this -> has ( $ key ) ) { throw UnknownOptionKey :: fromKey ( $ key ) ; } return $ this -> map [ $ key ] [ self :: SUBKEY_REPOSITORY ] ; } | Get the associated repository for a specific key . |
56,442 | public function put ( Option $ option , OptionRepository $ repository ) : Option { $ this -> map [ $ option -> getKey ( ) ] = [ self :: SUBKEY_OPTION => $ option , self :: SUBKEY_REPOSITORY => $ repository , ] ; return $ option ; } | Put a new association into the identity map . |
56,443 | protected function createForm ( CollectionInterface $ filterCollection , $ name = null , array $ rootFormBuilderOptions = [ ] , array $ filterFormBuilderOptions = [ ] ) { $ rootFormBuilder = $ this -> createFormBuilder ( $ name , 'form' , null , $ rootFormBuilderOptions ) ; if ( $ filterCollection -> hasFilters ( ) ) {... | Creates the filtration form . |
56,444 | protected function appendFormField ( FilterHasFormInterface $ filter , FormBuilderInterface $ filterFormBuilder ) { if ( ! ( $ filter instanceof CustomAppendFormFieldsInterface ) ) { $ filter -> appendFormFieldsToForm ( $ filterFormBuilder ) ; return $ filter ; } $ callableFunction = $ filter -> getAppendFormFieldsFunc... | The main actor here . Appends a filter to the representation form . If the filter has defined a custom function for form appending than it will be used . |
56,445 | protected function createFormBuilder ( $ name = null , $ type = 'form' , $ data = null , array $ options = [ ] ) { if ( $ name !== null ) { return $ this -> formFactory -> createNamedBuilder ( $ name , $ type , $ data , $ options ) ; } return $ this -> formFactory -> createBuilder ( $ type , $ data , $ options ) ; } | Creates and returns a form builder . |
56,446 | protected function validateConfig ( array $ config ) { $ requiredKeys = [ 'form_filter_type_class' ] ; foreach ( $ requiredKeys as $ key ) { if ( ! array_key_exists ( $ key , $ config ) ) { throw new FormCreatorException ( sprintf ( 'Key "%s" must be presented in the filters configuration.' , $ key ) ) ; } if ( ! class... | Validates configuration . |
56,447 | public function cmdGetCategoryGroup ( ) { $ result = $ this -> getListCategoryGroup ( ) ; $ this -> outputFormat ( $ result ) ; $ this -> outputFormatTableCategoryGroup ( $ result ) ; $ this -> output ( ) ; } | Callback for category - group - get command |
56,448 | public function cmdUpdateCategoryGroup ( ) { $ params = $ this -> getParam ( ) ; if ( empty ( $ params [ 0 ] ) || count ( $ params ) < 2 ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid command' ) ) ; } if ( ! is_numeric ( $ params [ 0 ] ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid argument' ) ) ; } $... | Callback for category - group - update command |
56,449 | protected function addCategoryGroup ( ) { if ( ! $ this -> isError ( ) ) { $ id = $ this -> category_group -> add ( $ this -> getSubmitted ( ) ) ; if ( empty ( $ id ) ) { $ this -> errorAndExit ( $ this -> text ( 'Unexpected result' ) ) ; } $ this -> line ( $ id ) ; } } | Add a new category group |
56,450 | protected function submitAddCategoryGroup ( ) { $ this -> setSubmitted ( null , $ this -> getParam ( ) ) ; $ this -> validateComponent ( 'category_group' ) ; $ this -> addCategoryGroup ( ) ; } | Add a new category group at once |
56,451 | protected function wizardAddCategoryGroup ( ) { $ this -> validatePrompt ( 'title' , $ this -> text ( 'Name' ) , 'category_group' ) ; $ this -> validatePrompt ( 'store_id' , $ this -> text ( 'Store ID' ) , 'category_group' ) ; $ this -> validateMenu ( 'type' , $ this -> text ( 'Type' ) , 'category_group' , $ this -> ca... | Add a new category group step by step |
56,452 | protected function RenderCheckbox ( $ name ) { $ checkbox = new Checkbox ( $ this -> namePrefix . $ name ) ; $ class = new \ ReflectionClass ( $ this ) ; $ checkbox -> SetLabel ( Trans ( 'Core.' . $ class -> getShortName ( ) . '.' . $ name ) ) ; if ( $ this -> Value ( $ name ) ) { $ checkbox -> SetChecked ( ) ; } $ fie... | Renders a specific checkbox |
56,453 | protected function Value ( $ name ) { if ( Request :: IsPost ( ) ) { return ( bool ) trim ( Request :: PostData ( $ this -> namePrefix . $ name ) ) ; } if ( $ this -> Rights ( ) ) { return $ this -> Rights ( ) -> $ name ; } if ( $ this -> ParentRights ( ) ) { return $ this -> ParentRights ( ) -> $ name ; } return false... | Gets the posted value of the name optional name prefix automatically attached |
56,454 | public function reset ( ) { $ this -> _headers -> clearHeaders ( ) ; $ this -> params = [ ] ; $ this -> postRawData = null ; $ this -> httpClient -> reset ( ) ; return $ this ; } | Reset request information |
56,455 | public function send ( ) { if ( empty ( $ this -> uri ) ) { throw new InvalidArgumentException ( 'Invalid url for request.' ) ; } $ customRequest = new Request ( ) ; $ customRequest -> setHeaders ( $ this -> _headers ) ; $ this -> httpClient -> setRequest ( $ customRequest ) ; $ this -> httpClient -> setMethod ( $ this... | Send http request |
56,456 | private function genericDefaultHeaders ( ) { $ this -> addRawHeaderLine ( 'Cache-Control' , 'no-cache' ) ; $ this -> addRawHeaderLine ( 'Pragma' , 'no-cache' ) ; $ this -> addRawHeaderLine ( 'Connection' , 'keep-alive' ) ; $ this -> addRawHeaderLine ( 'Upgrade-Insecure-Requests' , '1' ) ; $ this -> addRawHeaderLine ( '... | Default request headers |
56,457 | public function getLogger ( ExposedContainerInterface $ container , InjectionPointInterface $ point = NULL ) { $ channel = ( $ point === NULL ) ? 'app' : str_replace ( '\\' , '.' , $ point -> getTypeName ( ) ) ; if ( isset ( $ this -> loggers [ $ channel ] ) ) { return $ this -> loggers [ $ channel ] ; } $ logger = new... | Obtain a logger instance the log channel will consist of the type name provided by the injection point where all namespace separators will be replaced by periods . |
56,458 | protected function replaceSpecialChars ( $ input ) { if ( is_array ( $ input ) ) { $ result = [ ] ; foreach ( $ input as $ k => $ v ) { $ result [ $ k ] = $ this -> replaceSpecialChars ( $ v ) ; } return $ result ; } return strtr ( $ input , [ '\n' => "\n" , '\t' => "\t" ] ) ; } | Recursively replaces special escape characters for line breaks and tabs with according characters . |
56,459 | public function getQueryBuilderPath ( $ propertyPath ) { if ( false === strpos ( $ propertyPath , '.' ) ) { return $ this -> alias . '.' . $ propertyPath ; } if ( isset ( $ this -> paths [ $ propertyPath ] ) ) { return $ this -> paths [ $ propertyPath ] ; } $ paths = explode ( '.' , $ propertyPath ) ; $ property = arra... | Converts the property path to a query builder path and configures the necessary joins . |
56,460 | private function getClassMetadata ( ) { if ( null !== $ this -> metadata ) { return $ this -> metadata ; } return $ this -> metadata = $ this -> manager -> getClassMetadata ( $ this -> getSource ( ) -> getClass ( ) ) ; } | Returns the class metadata . |
56,461 | public function getRulesWithSourceSpecification ( ) { $ rulesWithSource = [ ] ; foreach ( $ this -> attributeRules as $ name => $ rules ) { $ rulesWithSource [ $ name ] = array_filter ( $ rules , function ( $ rule ) { return isset ( $ rule [ 'source' ] ) ; } ) ; } return array_filter ( $ rulesWithSource ) ; } | Return all attribute rules eligible for attribute aggregation . |
56,462 | public function getSource ( $ attributeName ) { if ( $ this -> hasAttribute ( $ attributeName ) && isset ( $ this -> attributeRules [ $ attributeName ] [ 0 ] [ 'source' ] ) ) { return $ this -> attributeRules [ $ attributeName ] [ 0 ] [ 'source' ] ; } return 'idp' ; } | Loads the first source it finds in the list of attribute rules for the given attributeName . |
56,463 | public function on ( $ event , \ Closure $ callback ) : void { if ( ! Any :: isArray ( $ event ) ) { $ event = [ $ event ] ; } foreach ( $ event as $ item ) { $ this -> events [ $ item ] [ ] = $ callback ; } } | Catch the event if it occurred after this initiation of interception |
56,464 | public function listen ( $ event , \ Closure $ callback ) : void { if ( ! Any :: isArray ( $ event ) ) { $ event = [ $ event ] ; } foreach ( $ event as $ item ) { if ( Any :: isArray ( $ this -> runned ) && array_key_exists ( $ item , $ this -> runned ) ) { call_user_func_array ( $ callback , $ this -> runned [ $ item ... | Catch the event if it occurred before the initiation of interception |
56,465 | public function run ( ) : void { $ args = func_get_args ( ) ; if ( count ( $ args ) < 1 ) { return ; } $ eventName = array_shift ( $ args ) ; $ eventArgs = @ array_shift ( $ args ) ; if ( isset ( $ this -> events [ $ eventName ] ) && Any :: isArray ( $ this -> events [ $ eventName ] ) ) { foreach ( $ this -> events [ $... | Process event on happens |
56,466 | protected function getMethodFromAttributes ( $ attrs ) { if ( ! is_array ( $ attrs ) || ! isset ( $ attrs [ 'method' ] ) ) { return $ this -> getEventFromAttributes ( $ attrs ) ; } return $ attrs [ 'method' ] ; } | Returns the event method from the tag attributes . |
56,467 | protected function getPriorityFromAttributes ( $ attrs ) { if ( ! is_array ( $ attrs ) || ! isset ( $ attrs [ 'priority' ] ) ) { return 0 ; } $ p = intval ( $ attrs [ 'priority' ] ) ; return $ p < 0 ? 0 : $ p ; } | Returns the event priority from the tag attributes . If no priority specified returns priority 0 . |
56,468 | public function checkLevel ( $ level ) { if ( static :: $ levels === null ) { $ reflection = new \ ReflectionClass ( LogLevel :: class ) ; static :: $ levels = $ reflection -> getConstants ( ) ; } if ( ! in_array ( $ level , static :: $ levels ) ) { $ levels = implode ( ', ' , static :: $ levels ) ; throw new InvalidAr... | Check if level exists in list of possible levels Psr \ Log suggests to throw Psr \ Log \ InvalidArgumentException if incompatible log level passed |
56,469 | public function resetFGColors ( ) { static :: $ foregroundColorMap = [ LogLevel :: EMERGENCY => ForegroundColors :: YELLOW ( ) , LogLevel :: ALERT => ForegroundColors :: WHITE ( ) , LogLevel :: CRITICAL => ForegroundColors :: RED ( ) , LogLevel :: ERROR => ForegroundColors :: LIGHT_RED ( ) , LogLevel :: WARNING => Fore... | Set foreground colors map to default ones |
56,470 | public function resetBGColor ( ) { static :: $ backgroundColorMap = [ LogLevel :: EMERGENCY => BackgroundColors :: RED ( ) , LogLevel :: ALERT => BackgroundColors :: RED ( ) , LogLevel :: CRITICAL => BackgroundColors :: YELLOW ( ) , LogLevel :: ERROR => null , LogLevel :: WARNING => null , LogLevel :: NOTICE => null , ... | Set background colors map to default ones |
56,471 | public function resetOutputStreams ( ) { defined ( 'STDOUT' ) || define ( 'STDOUT' , fopen ( 'php://stdout' , 'w' ) ) ; defined ( 'STDERR' ) || define ( 'STDERR' , fopen ( 'php://stderr' , 'w' ) ) ; static :: $ streamsMap = [ LogLevel :: EMERGENCY => STDERR , LogLevel :: ALERT => STDERR , LogLevel :: CRITICAL => STDERR... | Set output streams map to default map |
56,472 | public function setFGColor ( $ level , ForegroundColors $ color ) { if ( static :: $ foregroundColorMap === null ) { $ this -> resetFGColors ( ) ; } $ this -> checkLevel ( $ level ) ; static :: $ foregroundColorMap [ $ level ] = $ color ; return $ this ; } | Set foreground color for specified level |
56,473 | public function setBGColor ( $ level , ForegroundColors $ color ) { if ( static :: $ foregroundColorMap === null ) { $ this -> resetBGColor ( ) ; } $ this -> checkLevel ( $ level ) ; static :: $ foregroundColorMap [ $ level ] = $ color ; return $ this ; } | Set background color for specified level |
56,474 | public function setOutputStream ( $ level , $ stream ) { if ( static :: $ streamsMap === null ) { $ this -> resetOutputStreams ( ) ; } $ this -> checkLevel ( $ level ) ; if ( ! is_resource ( $ stream ) ) { throw new \ UnexpectedValueException ( "Argument '\$stream' must be a writable stream resource" ) ; } static :: $ ... | Set output stream for specified level |
56,475 | public function showAction ( ) { $ this -> isGranted ( 'VIEW' ) ; $ this -> container -> get ( 'ekyna_admin.menu.builder' ) -> breadcrumbAppend ( 'settings' , 'ekyna_setting.parameter.label.plural' ) ; $ manager = $ this -> getSettingsManager ( ) ; $ schemas = $ this -> getSettingsRegistry ( ) -> getSchemas ( ) ; $ set... | Show the parameters . |
56,476 | public function editAction ( Request $ request ) { $ this -> isGranted ( 'EDIT' ) ; $ this -> container -> get ( 'ekyna_admin.menu.builder' ) -> breadcrumbAppend ( 'settings' , 'ekyna_setting.parameter.label.plural' ) ; $ manager = $ this -> getSettingsManager ( ) ; $ schemas = $ this -> getSettingsRegistry ( ) -> getS... | Edit the parameters . |
56,477 | public function title ( ) { $ model_name = $ this -> model_name ; if ( isset ( $ this -> $ model_name -> title ) ) { return $ this -> $ model_name -> title ; } return Arr :: path ( $ this -> tanuki ( ) , 'title' ) ; } | Set HTML title tag |
56,478 | public function setupMessage ( Message $ message ) { $ this -> addRecipients ( $ message ) ; $ this -> setSubject ( $ message ) ; $ this -> callCustomBuilder ( $ message ) ; } | This method will be called by the returned closure |
56,479 | protected function addRecipients ( Message $ message ) { if ( $ overwriteTo = $ this -> getOverwriteTo ( ) ) { $ message -> to ( $ overwriteTo ) ; return ; } $ first = true ; foreach ( $ this -> recipients as $ recipient ) { if ( $ first ) { $ message -> to ( $ recipient ) ; } else { $ message -> bcc ( $ recipient ) ; ... | Adds the recipients to the message |
56,480 | protected function setSubject ( Message $ message ) { if ( ! isset ( $ this -> data [ 'subject' ] ) ) { throw new OutOfBoundsException ( "You have to pass a subject key and value in your view data" ) ; } $ message -> subject ( $ this -> data [ 'subject' ] ) ; } | Sets tzhe subject of the message |
56,481 | public function generatePivotTable ( ) { $ tables = [ $ this -> getManager ( ) -> getTable ( ) , $ this -> getWith ( ) -> getTable ( ) ] ; sort ( $ tables ) ; return implode ( "_" , $ tables ) ; } | Builds the name of a has - and - belongs - to - many association table |
56,482 | public function glob ( $ pattern ) { foreach ( glob ( $ pattern ) as $ result ) { $ this -> builder -> add ( $ result ) ; } } | Expands the glob pattern and add the results as arguments . |
56,483 | public function tostr ( ... $ strings ) { $ new_string = '' ; foreach ( $ strings as $ temp ) { switch ( gettype ( $ temp ) ) { case "array" : $ it = new \ RecursiveIteratorIterator ( new \ RecursiveArrayIterator ( $ temp ) ) ; foreach ( $ it as $ v ) { $ temp_str .= ' ' . $ this -> tostr ( $ v ) ; } break ; default : ... | Take n arguments and combine them into a single string and return that string |
56,484 | public function wordWrap ( $ string ) { return wordwrap ( $ string , $ this -> line_length , $ this -> break_string , $ this -> split_mid_word ) ; } | Return a string wrapped either at a word or close to the words completion using the break_string defined on the object |
56,485 | public function massColor ( array $ strings , string $ color ) { $ len_array = count ( $ strings ) ; for ( $ i = 0 ; $ i < $ len_array ; $ i ++ ) { $ strings [ $ i ] = $ this -> colorize -> { $ color } ( $ strings [ $ i ] ) ; } return $ strings ; } | Mass colorize an array of strings |
56,486 | public function setRGB ( $ rgbValue ) : Color { if ( \ is_string ( $ rgbValue ) ) { $ this -> setRGBString ( $ rgbValue ) ; } else if ( \ is_array ( $ rgbValue ) && \ count ( $ rgbValue ) > 2 ) { $ this -> setRGBArray ( $ rgbValue ) ; } else { throw new ArgumentError ( 'rgbValue' , $ rgbValue , 'Drawing' , 'Illegal RGB... | Sets a new color defined by a valid RGB value . |
56,487 | public static function FromString ( $ objectString ) { if ( false !== ( $ rgb = ColorTool :: Color2Rgb ( $ objectString ) ) ) { return new Color ( ColorTool :: Rgb2Hex ( $ rgb [ 0 ] , $ rgb [ 1 ] , $ rgb [ 2 ] ) ) ; } if ( false !== ( $ hex = self :: RgbStringToHex ( $ objectString ) ) ) { return new Color ( $ hex ) ; ... | Init a new instance from defined string . |
56,488 | public static function FromArray ( array $ objectData ) { if ( \ count ( $ objectData ) == 3 ) { if ( false !== ( $ hex = ColorTool :: Color2Hex ( $ objectData ) ) ) { return new Color ( $ hex ) ; } } $ rgb = array ( ) ; if ( isset ( $ objectData [ 'r' ] ) ) { $ rgb [ 0 ] = \ intval ( $ objectData [ 'r' ] ) ; } else if... | Init a new instance from defined array . |
56,489 | public static function FromGdValueWithAlpha ( $ gdValueWithAlpha ) { $ a = ( $ gdValueWithAlpha >> 24 ) & 0xFF ; $ r = ( $ gdValueWithAlpha >> 16 ) & 0xFF ; $ g = ( $ gdValueWithAlpha >> 8 ) & 0xFF ; $ b = $ gdValueWithAlpha & 0xFF ; if ( $ a == 0 ) { $ o = 0 ; } else if ( $ a == 127 ) { $ o = 100 ; } else { $ o = \ in... | Converts a GD integer value as color with alpha channel to an \ Beluga \ Drawing \ Color instance . |
56,490 | protected function _getData ( $ key ) { $ separator = $ this -> _getPathSegmentSeparator ( ) ; $ path = $ this -> _normalizePath ( $ key , $ separator ) ; $ store = $ this -> _getDataStore ( ) ; return $ this -> _containerGetPath ( $ store , $ path ) ; } | Retrieves the data associated with the specified key or path . |
56,491 | public function findClassName ( $ className ) { if ( ! empty ( $ this -> lookupCache -> classes [ $ className ] ) ) { return $ this -> lookupCache -> classes [ $ className ] ; } if ( class_exists ( $ className ) ) return $ className ; $ startsWithSlash = ( $ className [ 0 ] == '\\' ) ; foreach ( $ this -> searchOrder a... | Find class name |
56,492 | public static function slugify ( $ str , $ replace = array ( ) , $ delimiter = '-' ) { if ( ! empty ( $ replace ) ) { $ str = str_replace ( ( array ) $ replace , ' ' , $ str ) ; } $ clean = iconv ( 'UTF-8' , 'ASCII//TRANSLIT//IGNORE' , $ str ) ; $ clean = preg_replace ( "/[^a-zA-Z0-9\/_|+ -]/" , '' , $ clean ) ; $ clea... | Convert a string to url friendly slug |
56,493 | public static function iconByFileType ( $ fileType ) { foreach ( self :: $ fileTypeIcons as $ needle => $ icon ) { if ( strpos ( $ fileType , $ needle ) !== false ) { return $ icon ; } } return 'file-o' ; } | Selects the right font - awesome icon for each filetype |
56,494 | public static function humanFileSize ( $ size , $ unit = '' ) { if ( self :: isHumanFilesizeUnitGb ( $ size , $ unit ) ) { return number_format ( $ size / ( 1 << 30 ) , 2 ) . 'GB' ; } if ( self :: isHumanFilesizeUnitMb ( $ size , $ unit ) ) { return number_format ( $ size / ( 1 << 20 ) , 2 ) . 'MB' ; } if ( self :: isH... | Converts an amount of bytes to a human readable format |
56,495 | protected function render ( $ tmpl , $ in_data = array ( ) ) { try { $ data = array ( ) ; $ app = array ( ) ; $ app [ 'content' ] = $ in_data ; $ app [ 'settings' ] = $ this -> _viewData [ 'settings' ] ; $ data [ 'app' ] = $ app ; $ data [ 'global' ] = array ( 'styles' => $ this -> _viewData [ 'styles' ] ) ; $ data [ '... | Renders a given template along with input data . |
56,496 | private function syncFilesystemConfig ( ) { foreach ( $ this -> config ( ) -> get ( 'arcanesoft.media.filesystem.disks' , [ ] ) as $ disk => $ config ) { $ this -> config ( ) -> set ( "filesystems.disks.$disk" , $ config ) ; } } | Sync the filesystem config . |
56,497 | public function loadFile ( string $ file ) { $ path = $ this -> basePath . '/' . $ file . '.phtml' ; if ( ! is_readable ( $ path ) ) { throw new TemplateException ( sprintf ( 'Template engine could not read the file "%s"' , $ path ) ) ; } ; if ( ( $ this -> contents = file_get_contents ( $ path ) ) === false ) { throw ... | Loads a template file into memory |
56,498 | public function write ( ) { $ capfile = '' ; foreach ( $ this -> parameters as $ namespace ) { $ line = str_replace ( '<requirement>' , $ namespace , self :: $ template ) ; $ capfile = sprintf ( '%s%s%s' , $ capfile , PHP_EOL , $ line ) ; } $ capfile .= self :: $ importTemplate ; fwrite ( $ this -> file , $ this -> add... | Writes Capfile . |
56,499 | public static function fromString ( $ cookie ) { $ data = self :: $ defaults ; $ pieces = array_filter ( array_map ( 'trim' , explode ( ';' , $ cookie ) ) ) ; if ( empty ( $ pieces ) || ! strpos ( $ pieces [ 0 ] , '=' ) ) { return new self ( $ data ) ; } foreach ( $ pieces as $ part ) { $ cookieParts = explode ( '=' , ... | Create a new SetCookie object from a string |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.