idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
237,300 | public function compile ( ExpressCompiler $ compiler , $ flags = 0 ) { try { if ( $ flags & self :: FLAG_RAW ) { $ compiler -> write ( var_export ( $ this -> text , true ) ) ; } else { $ compiler -> out ( htmlspecialchars ( $ this -> text , ENT_COMPAT | ENT_XML1 | ENT_SUBSTITUTE , 'UTF-8' ) ) ; } } catch ( ExpressViewE... | Compiles the text node into it s PHP code . |
237,301 | public static function isBoolean ( $ value , $ message = null ) { if ( ! is_bool ( $ value ) ) { throw new InvalidArgumentException ( sprintf ( $ message ? : 'Expected boolean, but got %s' , Helper :: typeToString ( $ value ) ) ) ; } } | Assert that the value is boolean . |
237,302 | public static function isInteger ( $ value , $ message = null ) { if ( ! is_int ( $ value ) ) { throw new InvalidArgumentException ( sprintf ( $ message ? : 'Expected integer, but got %s' , Helper :: typeToString ( $ value ) ) ) ; } } | Assert that the value is integer . |
237,303 | public static function isNumeric ( $ value , $ message = null ) { if ( ! is_numeric ( $ value ) ) { throw new InvalidArgumentException ( sprintf ( $ message ? : 'Expected numeric, but got %s' , Helper :: typeToString ( $ value ) ) ) ; } } | Assert that the value is numeric . |
237,304 | public static function isFloat ( $ value , $ message = null ) { if ( ! is_float ( $ value ) ) { throw new InvalidArgumentException ( sprintf ( $ message ? : 'Expected float, but got %s' , Helper :: typeToString ( $ value ) ) ) ; } } | Assert that the value is float . |
237,305 | public static function isString ( $ value , $ message = null ) { if ( ! is_string ( $ value ) ) { throw new InvalidArgumentException ( sprintf ( $ message ? : 'Expected string, but got %s' , Helper :: typeToString ( $ value ) ) ) ; } } | Assert that the value is string . |
237,306 | public static function isScalar ( $ value , $ message = null ) { if ( ! is_scalar ( $ value ) ) { throw new InvalidArgumentException ( sprintf ( $ message ? : 'Expected scalar, but got %s' , Helper :: typeToString ( $ value ) ) ) ; } } | Assert that the value is scalar . |
237,307 | public static function isArray ( $ value , $ message = null ) { if ( ! is_array ( $ value ) ) { throw new InvalidArgumentException ( sprintf ( $ message ? : 'Expected array, but got %s' , Helper :: typeToString ( $ value ) ) ) ; } } | Assert that the value is array . |
237,308 | public static function isInstanceOf ( $ value , $ class , $ message = null ) { if ( ! $ value instanceof $ class ) { throw new InvalidArgumentException ( sprintf ( $ message ? : 'Expected instance of %2$s, but got %s' , Helper :: typeToString ( $ value ) , $ class ) ) ; } } | Assert that the value is instance of class . |
237,309 | public static function isResource ( $ value , $ message = null ) { if ( ! is_resource ( $ value ) ) { throw new InvalidArgumentException ( sprintf ( $ message ? : 'Expected resource, but got %s' , Helper :: typeToString ( $ value ) ) ) ; } } | Assert that the value is resource . |
237,310 | public static function isDirectory ( $ value , $ message = null ) { if ( ! is_string ( $ value ) || ! is_dir ( $ value ) ) { throw new InvalidArgumentException ( sprintf ( $ message ? : 'Expected directory, but got %s' , Helper :: valueToString ( $ value ) ) ) ; } } | Assert that the value is directory . |
237,311 | public static function isFile ( $ value , $ message = null ) { if ( ! is_string ( $ value ) || ! is_file ( $ value ) ) { throw new InvalidArgumentException ( sprintf ( $ message ? : 'Expected file, but got %s' , Helper :: valueToString ( $ value ) ) ) ; } } | Assert that the value is file . |
237,312 | public static function isNullOrBoolean ( $ value , $ message = null ) { if ( ! is_null ( $ value ) && ! is_bool ( $ value ) ) { throw new InvalidArgumentException ( sprintf ( $ message ? : 'Expected null or boolean, but got %s' , Helper :: typeToString ( $ value ) ) ) ; } } | Assert that the value is null or boolean . |
237,313 | public static function isNullOrInteger ( $ value , $ message = null ) { if ( ! is_null ( $ value ) && ! is_int ( $ value ) ) { throw new InvalidArgumentException ( sprintf ( $ message ? : 'Expected null or integer, but got %s' , Helper :: typeToString ( $ value ) ) ) ; } } | Assert that the value is null or integer . |
237,314 | public static function isNullOrNumeric ( $ value , $ message = null ) { if ( ! is_null ( $ value ) && ! is_numeric ( $ value ) ) { throw new InvalidArgumentException ( sprintf ( $ message ? : 'Expected null or numeric, but got %s' , Helper :: typeToString ( $ value ) ) ) ; } } | Assert that the value is null or numeric . |
237,315 | public static function isNullOrFloat ( $ value , $ message = null ) { if ( ! is_null ( $ value ) && ! is_float ( $ value ) ) { throw new InvalidArgumentException ( sprintf ( $ message ? : 'Expected null or float, but got %s' , Helper :: typeToString ( $ value ) ) ) ; } } | Assert that the value is null or float . |
237,316 | public static function isNullOrString ( $ value , $ message = null ) { if ( ! is_null ( $ value ) && ! is_string ( $ value ) ) { throw new InvalidArgumentException ( sprintf ( $ message ? : 'Expected null or string, but got %s' , Helper :: typeToString ( $ value ) ) ) ; } } | Assert that the value is null or string . |
237,317 | public static function isNullOrScalar ( $ value , $ message = null ) { if ( ! is_null ( $ value ) && ! is_scalar ( $ value ) ) { throw new InvalidArgumentException ( sprintf ( $ message ? : 'Expected null or scalar, but got %s' , Helper :: typeToString ( $ value ) ) ) ; } } | Assert that the value is null or scalar . |
237,318 | public static function isNullOrArray ( $ value , $ message = null ) { if ( ! is_null ( $ value ) && ! is_array ( $ value ) ) { throw new InvalidArgumentException ( sprintf ( $ message ? : 'Expected null or array, but got %s' , Helper :: typeToString ( $ value ) ) ) ; } } | Assert that the value is null or array . |
237,319 | public static function isNullOrCallable ( $ value , $ message = null ) { if ( ! is_null ( $ value ) && ! is_callable ( $ value ) ) { throw new InvalidArgumentException ( sprintf ( $ message ? : 'Expected null or callable, but got %s' , Helper :: typeToString ( $ value ) ) ) ; } } | Assert that the value is null or callable . |
237,320 | public static function isNullOrInstanceOf ( $ value , $ class , $ message = null ) { if ( ! is_null ( $ value ) && ! $ value instanceof $ class ) { throw new InvalidArgumentException ( sprintf ( $ message ? : 'Expected null or instance of %2$s, but got %s' , Helper :: typeToString ( $ value ) , $ class ) ) ; } } | Assert that the value is null or instance of class . |
237,321 | public static function isNullOrTraversable ( $ value , $ message = null ) { if ( ! is_null ( $ value ) && ! is_array ( $ value ) && ! $ value instanceof Traversable ) { throw new InvalidArgumentException ( sprintf ( $ message ? : 'Expected null or traversable, but got %s' , Helper :: typeToString ( $ value ) ) ) ; } } | Assert that the value is null or traversable . |
237,322 | public static function isNullOrResource ( $ value , $ message = null ) { if ( ! is_null ( $ value ) && ! is_resource ( $ value ) ) { throw new InvalidArgumentException ( sprintf ( $ message ? : 'Expected null or resource, but got %s' , Helper :: typeToString ( $ value ) ) ) ; } } | Assert that the value is null or resource . |
237,323 | public static function isNullOrDirectory ( $ value , $ message = null ) { if ( ! is_null ( $ value ) && ! ( is_string ( $ value ) && is_dir ( $ value ) ) ) { throw new InvalidArgumentException ( sprintf ( $ message ? : 'Expected null or directory, but got %s' , Helper :: valueToString ( $ value ) ) ) ; } } | Assert that the value is null or directory . |
237,324 | public static function isNullOrFile ( $ value , $ message = null ) { if ( ! is_null ( $ value ) && ! ( is_string ( $ value ) && is_file ( $ value ) ) ) { throw new InvalidArgumentException ( sprintf ( $ message ? : 'Expected null or file, but got %s' , Helper :: valueToString ( $ value ) ) ) ; } } | Assert that the value is null or file . |
237,325 | public static function keyExists ( $ value , $ key , $ message = null ) { if ( ! array_key_exists ( $ key , $ value ) ) { throw new InvalidArgumentException ( sprintf ( $ message ? : 'Expected array key %2$s to exist' , Helper :: typeToString ( $ value ) , Helper :: valueToString ( $ key ) ) ) ; } } | Assert that key exists in value . |
237,326 | public static function inArray ( $ value , array $ array , $ message = null ) { if ( ! in_array ( $ value , $ array ) ) { throw new InvalidArgumentException ( sprintf ( $ message ? : 'Value %s is not in array' , Helper :: valueToString ( $ value ) ) ) ; } } | Assert that value is in array . |
237,327 | protected function doExecute ( ActionInterface $ action , $ reprocess = false ) { $ definition = $ this -> findActionDefinitionByName ( $ action -> getName ( ) ) ; if ( null == $ definition ) { throw new \ RuntimeException ( sprintf ( 'Could not load action definition for action %a' , $ action -> getName ( ) ) ) ; } $ ... | Start the execution of an action or schedule the action for processing later on |
237,328 | public static function getStatusMessage ( $ code ) { if ( ! $ code ) { return '' ; } return isset ( self :: $ statusMessages [ $ code ] ) ? self :: $ statusMessages [ $ code ] : '' ; } | Returns a messages for a given code |
237,329 | protected function addOrEditObject ( $ data = [ ] , $ redirect = TRUE ) { try { if ( $ this -> detailObject ) { $ this -> canUser ( 'edit' ) ; $ this -> mainManager -> edit ( $ this -> detailObject -> id , $ data ) ; $ this -> flashMessage ( 'Object saved' ) ; } else { $ this -> canUser ( 'add' ) ; $ this -> mainManage... | Simple implementation add or edit object |
237,330 | 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 |
237,331 | 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 |
237,332 | 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 |
237,333 | protected function getListBackup ( ) { $ options = $ this -> query_filter ; $ options [ 'limit' ] = $ this -> data_limit ; return $ this -> backup -> getList ( $ options ) ; } | Returns an array of backups |
237,334 | 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 |
237,335 | 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 |
237,336 | 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 . |
237,337 | 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 . |
237,338 | 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 . |
237,339 | 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 |
237,340 | 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 |
237,341 | 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 |
237,342 | 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 |
237,343 | 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 |
237,344 | 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 . |
237,345 | 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 . |
237,346 | 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 . |
237,347 | 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 . |
237,348 | 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 |
237,349 | 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 |
237,350 | 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 . |
237,351 | public function unsetHook ( ) { if ( $ this -> hook_reference !== null ) { Hook :: unsubscribe ( Hook :: SHUTDOWN_HOOK , $ this -> hook_reference ) ; } } | Remove the hook - cancelling automatic save on termination |
237,352 | 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 |
237,353 | public function getCache ( string $ name ) { if ( ! isset ( $ this -> repository [ $ name ] ) ) $ this -> loadCache ( $ name ) ; return new Cache ( $ name , $ this -> repository [ $ name ] ) ; } | Return a cache |
237,354 | protected function getStub ( $ name ) { if ( stripos ( $ name , '.php' ) === false ) $ name = $ name . '.php' ; $ this -> files -> get ( $ this -> getStubPath ( ) . '/' . $ name ) ; } | Get the given stub by name . |
237,355 | 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 . |
237,356 | protected function getCommandArguments ( InputInterface $ input ) { $ package = $ this -> getPackageInformation ( $ input -> getOption ( 'package' ) ) ; return [ $ this -> getComposer ( ) , $ this -> composerOperation , $ package , ] ; } | Returns command arguments used in ProcessBuilder |
237,357 | 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 |
237,358 | 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 |
237,359 | 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 |
237,360 | protected function broadcastToClients ( \ SplObjectStorage $ clients ) { foreach ( $ clients as $ client ) { $ client -> sendString ( $ this -> processOutput ( ) ) ; } } | Sends processed output to all connected clients |
237,361 | 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 . |
237,362 | 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 |
237,363 | 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 |
237,364 | 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 |
237,365 | 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 |
237,366 | 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 |
237,367 | 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 |
237,368 | 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 . |
237,369 | 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 |
237,370 | 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 . |
237,371 | 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 . |
237,372 | 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 . |
237,373 | 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 . |
237,374 | 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 . |
237,375 | 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 . |
237,376 | 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 . |
237,377 | public function cmdGetCategoryGroup ( ) { $ result = $ this -> getListCategoryGroup ( ) ; $ this -> outputFormat ( $ result ) ; $ this -> outputFormatTableCategoryGroup ( $ result ) ; $ this -> output ( ) ; } | Callback for category - group - get command |
237,378 | 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 |
237,379 | 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 |
237,380 | protected function submitAddCategoryGroup ( ) { $ this -> setSubmitted ( null , $ this -> getParam ( ) ) ; $ this -> validateComponent ( 'category_group' ) ; $ this -> addCategoryGroup ( ) ; } | Add a new category group at once |
237,381 | 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 |
237,382 | 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 |
237,383 | 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 |
237,384 | public function reset ( ) { $ this -> _headers -> clearHeaders ( ) ; $ this -> params = [ ] ; $ this -> postRawData = null ; $ this -> httpClient -> reset ( ) ; return $ this ; } | Reset request information |
237,385 | 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 |
237,386 | 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 |
237,387 | 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 . |
237,388 | 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 . |
237,389 | 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 . |
237,390 | private function getClassMetadata ( ) { if ( null !== $ this -> metadata ) { return $ this -> metadata ; } return $ this -> metadata = $ this -> manager -> getClassMetadata ( $ this -> getSource ( ) -> getClass ( ) ) ; } | Returns the class metadata . |
237,391 | 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 . |
237,392 | 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 . |
237,393 | 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 |
237,394 | 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 |
237,395 | 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 |
237,396 | 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 . |
237,397 | 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 . |
237,398 | 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 |
237,399 | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.