idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
17,300 | public function getPrefixedPath ( string $ path = '' ) : string { return trim ( $ this -> parent ? ( $ this -> parent -> getPrefixedPath ( $ this -> prefix ? $ this -> prefix . '/' . $ path : $ path ) ) : ( $ this -> prefix ? $ this -> prefix . '/' . $ path : $ path ) , '/' ) ; } | Gets path prefix of this context and all its parents |
17,301 | public function addMiddleware ( callable $ middleware , string $ type = self :: BEFORE ) { ; $ type = self :: validateMiddlewareType ( $ type ) ; $ this -> middlewares [ $ type ] [ ] = $ middleware ; } | Adds a new middleware to this context |
17,302 | public function addSubContext ( string $ prefix , Closure $ invoker ) : RoutingContext { return $ this -> contexts [ ] = new RoutingContext ( $ prefix , $ invoker , $ this ) ; } | Adds a new sub context to this context |
17,303 | function it_retains_the_original_state_of_the_instance_duplicated_with_new_scheme ( ) { $ original_uri = ( string ) $ this -> getWrappedObject ( ) ; $ new_scheme = $ this -> withScheme ( "http" ) ; $ this -> __toString ( ) -> shouldReturn ( $ original_uri ) ; } | This method MUST retain the state of the current instance and return an instance that contains the specified scheme . |
17,304 | function it_retains_the_original_state_of_the_instance_duplicated_with_new_authority ( ) { $ original_uri = ( string ) $ this -> getWrappedObject ( ) ; $ new_authority = $ this -> withAuthority ( "corge:grault@quux.qux:9999" ) ; $ this -> __toString ( ) -> shouldReturn ( $ original_uri ) ; } | This method MUST retain the state of the current instance and return an instance that contains the specified authority . |
17,305 | function it_replaces_authority_components_with_new_authority ( ) { $ new_authority = $ this -> withAuthority ( "corge:grault@quux.qux:9999" ) ; $ new_authority -> getAuthority ( ) -> shouldReturn ( "corge:grault@quux.qux:9999" ) ; $ new_authority -> getUserInfo ( ) -> shouldReturn ( "corge:grault" ) ; $ new_authority -... | Replacing the authority is equivalent to replacing or removing all authority components depending upon the composition of the authority . |
17,306 | function it_removes_authority_components_with_empty_authority ( ) { $ new_authority = $ this -> withAuthority ( "" ) ; $ new_authority -> getAuthority ( ) -> shouldReturn ( "" ) ; $ new_authority -> getUserInfo ( ) -> shouldReturn ( "" ) ; $ new_authority -> getHost ( ) -> shouldReturn ( "" ) ; $ new_authority -> getPo... | An empty authority is equivalent to removing the authority and all authority components . |
17,307 | function it_retains_the_original_state_of_the_instance_duplicated_with_new_user_info ( ) { $ original_uri = ( string ) $ this -> getWrappedObject ( ) ; $ new_user_info = $ this -> withUserInfo ( "corge" , "grault" ) ; $ this -> __toString ( ) -> shouldReturn ( $ original_uri ) ; } | This method MUST retain the state of the current instance and return an instance that contains the specified user information . |
17,308 | function it_retains_the_original_state_of_the_instance_duplicated_with_a_new_host ( ) { $ original_uri = ( string ) $ this -> getWrappedObject ( ) ; $ new_host = $ this -> withHost ( "quux.qux" ) ; $ this -> __toString ( ) -> shouldReturn ( $ original_uri ) ; } | This method MUST retain the state of the current instance and return an instance that contains the specified host . |
17,309 | function it_retains_the_original_state_of_the_instance_duplicated_with_a_new_port ( ) { $ original_uri = ( string ) $ this -> getWrappedObject ( ) ; $ new_port = $ this -> withPort ( 9999 ) ; $ this -> __toString ( ) -> shouldReturn ( $ original_uri ) ; } | This method MUST retain the state of the current instance and return an instance that contains the specified port . |
17,310 | function it_retains_the_original_state_of_the_instance_duplicated_with_new_path ( ) { $ original_uri = ( string ) $ this -> getWrappedObject ( ) ; $ new_path = $ this -> withPath ( "/quux/quuz" ) ; $ this -> __toString ( ) -> shouldReturn ( $ original_uri ) ; } | This method MUST retain the state of the current instance and return an instance that contains the specified path . |
17,311 | function it_retains_the_original_state_of_the_instance_duplicated_with_new_query ( ) { $ original_uri = ( string ) $ this -> getWrappedObject ( ) ; $ new_query = $ this -> withQuery ( "garply" ) ; $ this -> __toString ( ) -> shouldReturn ( $ original_uri ) ; } | This method MUST retain the state of the current instance and return an instance that contains the specified query string . |
17,312 | public function supports ( $ template ) { foreach ( $ this -> engines as $ engine ) { if ( $ engine -> supports ( $ template ) ) { return true ; } } return false ; } | Checks if any of the engines can render the template . |
17,313 | public function exists ( $ template ) { foreach ( $ this -> engines as $ engine ) { if ( $ engine -> supports ( $ template ) ) { return $ engine -> exists ( $ template ) ; } } return false ; } | Checks if the template exists . |
17,314 | protected function GenerateConstantsClass ( $ files ) { if ( count ( $ files ) > 0 ) { $ classGen = new ConstantsClassGeneratorBase ( $ this -> params , $ files ) ; $ classGen -> BuildClass ( ) ; return str_replace ( '\\' , '/' , "file://" . "APP_ROOT_DIR" . $ this -> params [ BaseClassGenerator :: NameSpaceKey ] . "/"... | Generate the Constant Class list the framework . |
17,315 | protected function GenerateFrameworkFile ( $ files ) { $ filePath = $ this -> GenerateConstantsClass ( $ files ) ; array_push ( $ this -> filesGenerated , $ filePath ) ; return $ filePath ; } | Generate the FrameworkControllers . php class . |
17,316 | public static function Eform ( iauRefEllips $ n , & $ a , & $ f ) { switch ( $ n -> value ) { case WGS84 : $ a = 6378137.0 ; $ f = 1.0 / 298.257223563 ; break ; case GRS80 : $ a = 6378137.0 ; $ f = 1.0 / 298.257222101 ; break ; case WGS72 : $ a = 6378135.0 ; $ f = 1.0 / 298.26 ; break ; default : $ a = 0.0 ; $ f = 0.0 ... | - - - - - - - - - i a u E f o r m - - - - - - - - - |
17,317 | public static function mergeNatural ( array $ array1 , array $ array2 ) { if ( empty ( $ array1 ) ) { return $ array2 ; } $ result = $ array1 ; foreach ( $ array2 as $ key => $ value ) { if ( isset ( $ result [ $ key ] ) and is_array ( $ result [ $ key ] ) and is_array ( $ value ) ) { $ result [ $ key ] = static :: mer... | Merges two arrays recursive naturally Second array values takes precedence with exception that its value on particular place is null |
17,318 | public static function filterCaseInsensitively ( array $ needles , array $ haystack ) { $ result = array ( ) ; $ modifiedHaystack = array_change_key_case ( $ haystack , CASE_LOWER ) ; foreach ( $ needles as $ needle ) { $ modifiedNeedle = strtolower ( $ needle ) ; if ( array_key_exists ( $ needle , $ haystack ) ) { $ r... | Filter haystack using values in needles in case insensitive manner if needed |
17,319 | private function getItemBySource ( MappingInterface $ mapping , $ sourceSlug ) { if ( $ sourceSlug === $ mapping -> getLeftItem ( ) -> getSource ( ) -> getSlug ( ) ) { return $ mapping -> getLeftItem ( ) ; } return $ mapping -> getRightItem ( ) ; } | Get item by source . |
17,320 | public function _loadNotificationIntoQueue ( $ notification_entry ) { $ this -> queue_manager -> connection ( $ this -> queue_connection ) -> pushRaw ( json_encode ( $ notification_entry ) , $ this -> queue_name ) ; } | public for testing purposes |
17,321 | private function sortChildren ( ) { uasort ( $ this -> children , function ( MapperTreeItemInterface $ first , MapperTreeItemInterface $ second ) { if ( $ first -> getPriority ( ) >= $ second -> getPriority ( ) ) { return 1 ; } if ( $ first -> getPriority ( ) < $ second -> getPriority ( ) ) { return - 1 ; } } ) ; } | Sort item children . |
17,322 | public static function get ( array $ array , $ key , $ fallback = null ) { $ keys = explode ( '.' , $ key ) ; foreach ( $ keys as $ key ) { if ( ! isset ( $ array [ $ key ] ) ) { return $ fallback ; } $ array = $ array [ $ key ] ; } return $ array ; } | Get value from array |
17,323 | public static function pop ( array $ array , $ key ) { $ keys = explode ( '.' , $ key ) ; foreach ( $ keys as $ key ) { if ( ! isset ( $ array [ $ key ] ) ) { return null ; } $ array = $ array [ $ key ] ; } if ( ! is_array ( $ array ) ) { return null ; } return array_pop ( $ array ) ; } | Pop value from sub - array |
17,324 | public static function set ( array & $ array , $ key , $ value ) { $ keys = explode ( '.' , $ key ) ; foreach ( $ keys as $ key ) { if ( ! isset ( $ array [ $ key ] ) ) { $ array [ $ key ] = [ ] ; } $ array = & $ array [ $ key ] ; } $ array = $ value ; } | Set value in array |
17,325 | public static function push ( array & $ array , $ key , $ value ) { $ keys = explode ( '.' , $ key ) ; foreach ( $ keys as $ key ) { if ( ! isset ( $ array [ $ key ] ) ) { $ array [ $ key ] = [ ] ; } $ array = & $ array [ $ key ] ; } if ( ! is_array ( $ array ) ) { $ array = [ ] ; } array_push ( $ array , $ value ) ; } | Push value in sub - array |
17,326 | public static function drop ( array & $ array , $ key ) { $ keys = explode ( '.' , $ key ) ; $ last = array_pop ( $ keys ) ; foreach ( $ keys as $ key ) { if ( ! isset ( $ array [ $ key ] ) ) { return false ; } $ array = & $ array [ $ key ] ; } if ( isset ( $ array [ $ last ] ) ) { unset ( $ array [ $ last ] ) ; return... | Delete key in array |
17,327 | public function query ( $ query_string , Closure $ callback ) { $ query = $ this -> getQuery ( $ query_string ) ; $ query -> execute ( $ this , $ callback ) ; } | Execute a query using a closure to capture the results . |
17,328 | public function register ( $ identifier , $ value ) { parent :: register ( $ identifier , $ value ) ; $ sql = sprintf ( 'INSERT INTO %s (`entityId`, `data`) set (`%s`, `%s`);' , $ this -> mysql -> quote ( $ this -> section ) , $ this -> mysql -> quote ( $ identifier ) , $ this -> decorator -> normalizeValue ( $ value )... | Registers the provided value . |
17,329 | public function getContentById ( $ identifier , $ default = null ) { if ( empty ( $ this -> registry [ $ this -> section ] [ $ identifier ] ) ) { $ this -> registry [ $ this -> section ] [ $ identifier ] = $ this -> getContentByIds ( array ( $ identifier ) ) ; if ( empty ( $ this -> registry [ $ this -> section ] [ $ i... | Provides the registry content identified by its ID . |
17,330 | public function getContentByIds ( array $ identifiers ) { $ sql = sprintf ( 'SELECT * FROM %s WHERE entityId IN (`%s`);' , $ this -> mysql -> quote ( $ this -> section ) , implode ( '`,`' , $ identifiers ) ) ; $ result = $ this -> mysql -> query ( $ sql ) ; if ( false === $ result ) { $ this -> throwException ( 'Error ... | Provides a set of registry items . |
17,331 | public function replace ( $ identifier , $ value ) { $ oldValue = @ $ this -> registry [ $ this -> section ] [ $ identifier ] ; parent :: replace ( $ identifier , $ value ) ; $ sql = sprintf ( 'UPDATE %s SET `data`=`%s` WHERE `entityId`=`%s`;' , $ this -> mysql -> quote ( $ this -> section ) , $ this -> mysql -> quote ... | Replaces the identified entity with the provided one . |
17,332 | public function destroy ( ) { $ sql = sprintf ( 'DROP TABLE `%s`;' , $ this -> mysql -> quote ( $ this -> section ) ) ; if ( false === $ this -> mysql -> exec ( $ sql ) ) { $ this -> throwException ( 'Unable to delete the database: ' , $ this -> mysql -> errorInfo ( ) ) ; } $ this -> registry [ $ this -> section ] = ar... | Shall delete the current registry from the database . |
17,333 | public function init ( ) { $ this -> registryTableExists ( ) ; if ( empty ( $ this -> registry [ $ this -> section ] ) ) { $ this -> registry [ $ this -> section ] = $ this -> getContent ( ) ; } return $ this -> registry [ $ this -> section ] ; } | Shall register a new section in the registry |
17,334 | protected function registryTableExists ( ) { $ sql = sprintf ( 'SHOW CREATE TABLE `%s`;' , $ this -> mysql -> quote ( $ this -> section ) ) ; if ( false === $ this -> mysql -> query ( $ sql ) ) { $ this -> throwException ( 'The registry table does not exists: ' , $ this -> mysql -> errorInfo ( ) ) ; } } | Validates that the registry table exists . |
17,335 | public function getContent ( $ limit = 0 ) { $ this -> registry [ $ this -> section ] = parent :: getContent ( ) ; if ( empty ( $ this -> registry [ $ this -> section ] ) ) { $ sql = sprintf ( 'SELECT * FROM `%s`;' , $ this -> mysql -> quote ( $ this -> section ) ) ; $ result = $ this -> mysql -> query ( $ sql ) ; if (... | Provides the current content of the registry . |
17,336 | protected function processResult ( array $ results ) { foreach ( $ results as $ key => $ entity ) { if ( ! empty ( $ entity [ 'data' ] ) ) { $ entity [ 'data' ] = $ this -> decorator -> denormalizeValue ( $ entity [ 'data' ] ) ; $ results [ $ key ] = $ entity ; } } return $ results ; } | Processes the results to return a denormalized entity set . |
17,337 | public static function allInRangeOrAll ( $ value , $ minValue , $ maxValue ) { if ( is_array ( $ value ) ) { static :: allRange ( $ value , $ minValue , $ maxValue ) ; return ; } static :: eq ( $ value , 'all' ) ; } | Assert that value is a range of numbers or the string all |
17,338 | public static function choicesIsset ( array $ values , array $ choices ) { self :: notEmpty ( $ values , null , null ) ; foreach ( $ choices as $ choice ) { self :: keyIsset ( $ values , $ choice , null , null ) ; } } | Determines if the values array has every choice as key and that this choice has content . |
17,339 | public static function ip ( $ value ) { if ( ! is_string ( $ value ) and ! filter_var ( $ value , FILTER_VALIDATE_IP ) ) { $ message = sprintf ( 'Value "%s" expected to be a valid IP address.' , static :: stringify ( $ value ) ) ; throw static :: createException ( $ value , $ message , static :: INVALID_IP , null ) ; }... | Assert that value is a valid IP address |
17,340 | protected function getCommands ( array $ config ) { if ( ! is_array ( $ config [ 'plugins' ] ) ) { throw new \ RuntimeException ( 'Configuration "plugins" key must reference an array' , self :: ERR_PLUGINS_NONARRAY ) ; } $ plugins = array_filter ( $ config [ 'plugins' ] , function ( $ plugin ) { return $ plugin instanc... | Extracts command information from configuration . |
17,341 | public function handleHelpCommand ( CommandEvent $ event , EventQueueInterface $ queue ) { $ params = $ event -> getCustomParams ( ) ; if ( $ params ) { $ command = strtolower ( reset ( $ params ) ) ; $ eventName = 'command.' . $ command . '.help' ; $ this -> getEventEmitter ( ) -> emit ( $ eventName , array ( $ event ... | Responds to the help command . |
17,342 | protected function listCommands ( CommandEvent $ event , EventQueueInterface $ queue ) { $ targets = $ event -> getTargets ( ) ; $ target = reset ( $ targets ) ; $ nick = $ event -> getNick ( ) ; if ( $ target === $ event -> getConnection ( ) -> getNickname ( ) ) { $ target = $ nick ; $ address = '' ; } else { $ addres... | Responds to a parameter - less help command with a list of available commands . |
17,343 | private function alphabetize ( $ commands ) { $ commandList = array_keys ( $ commands ) ; sort ( $ commandList , SORT_NATURAL | SORT_FLAG_CASE ) ; return array_values ( $ commandList ) ; } | Sort array of commands |
17,344 | public function isLoggedIn ( ) { $ loggedIn = $ this -> di -> get ( "session" ) -> has ( "user" ) ; if ( ! $ loggedIn ) { $ this -> di -> get ( "response" ) -> redirect ( "user/login" ) ; return false ; } return true ; } | Check if user is logged in . |
17,345 | public function isAdmin ( $ redirect = false ) { if ( ! $ this -> isLoggedIn ( ) ) { $ this -> di -> get ( "response" ) -> redirect ( "user/login" ) ; return false ; } $ email = $ this -> di -> get ( "session" ) -> get ( "user" ) ; $ user = new User ( ) ; $ user -> setDb ( $ this -> di -> get ( "db" ) ) ; $ user -> fin... | Check if user is admin |
17,346 | public function hasAccessToComment ( $ commentID ) { $ this -> isLoggedIn ( ) ; $ userid = $ this -> di -> get ( "session" ) -> get ( "userid" ) ; $ comment = new Comment ( ) ; $ comment -> setDb ( $ this -> di -> get ( "db" ) ) ; $ user = new User ( ) ; $ user -> setDb ( $ this -> di -> get ( "db" ) ) ; $ user -> find... | Check if the user have access to the comment |
17,347 | public function load ( \ Zend_EventManager_EventDescription $ event ) { if ( false !== ( $ content = $ this -> cache -> load ( $ this -> _getIdentifier ( $ event ) ) ) ) { $ event -> stopPropagation ( true ) ; return $ content ; } } | Pre event - try load content from cache |
17,348 | public function save ( \ Zend_EventManager_EventDescription $ event ) { $ params = $ event -> getParams ( ) ; if ( ! isset ( $ params [ 'data' ] ) ) { throw new \ Zend_EventManager_Exception_InvalidArgumentException ( 'Missing param data.' ) ; } $ this -> cache -> save ( $ params [ 'data' ] , $ this -> _getIdentifier (... | Post event - save content in cache |
17,349 | public function clean ( \ Zend_EventManager_EventDescription $ event ) { $ params = $ event -> getParams ( ) ; $ mode = \ Zend_Cache :: CLEANING_MODE_MATCHING_ANY_TAG ; if ( isset ( $ params [ 'mode' ] ) ) { $ mode = $ params [ 'mode' ] ; } return $ this -> cache -> clean ( $ mode , $ this -> _getTags ( $ event ) ) ; } | Clear event - clear all cache by tags |
17,350 | protected function _getIdentifier ( \ Zend_EventManager_EventDescription $ event ) { $ params = $ event -> getParams ( ) ; if ( ! isset ( $ params [ 'id' ] ) ) { throw new \ Zend_EventManager_Exception_InvalidArgumentException ( 'Missing param id.' ) ; } return md5 ( $ this -> _getClassName ( $ event -> getTarget ( ) )... | Method return identifier name from class and id |
17,351 | protected function _getClassName ( $ target ) { $ className = $ target ; if ( is_object ( $ target ) ) { $ className = get_class ( $ target ) ; } return $ this -> _normalizeName ( $ className ) ; } | Method return target class name |
17,352 | protected function _getTags ( \ Zend_EventManager_EventDescription $ event ) { $ params = $ event -> getParams ( ) ; $ tags = array ( $ this -> _getClassName ( $ event -> getTarget ( ) ) ) ; if ( isset ( $ params [ 'tags' ] ) ) { if ( is_array ( $ params [ 'tags' ] ) ) { $ tags = array_merge ( $ tags , $ params [ 'tags... | Method return array of tags from event |
17,353 | public function merge ( DateLexerResult $ result ) { $ this -> offset = $ result -> offset ; $ this -> data = array_merge ( $ this -> data , $ result -> data ) ; } | Merges a result into this one . |
17,354 | public function getFirst ( $ name ) { $ names = func_get_args ( ) ; foreach ( $ names as $ name ) { if ( isset ( $ this -> data [ $ name ] ) ) { return $ this -> data [ $ name ] ; } } } | Get first set symbol value . |
17,355 | public function cdn ( $ name , $ url , $ type = null ) { if ( $ type === null ) { $ type = substr ( strrchr ( $ url , '.' ) , 1 ) ; } $ group = config ( 'assetprocessor.attributes.group.cdn' , 'cdn' ) ; $ this -> files [ $ type ] [ $ group ] [ $ name ] = $ url ; } | Used in order to allow for the use of a CDN for assets . |
17,356 | public function generateSingularFile ( $ type , $ group , $ directory ) { if ( ! isset ( $ this -> files [ $ type ] [ $ group ] ) ) { return null ; } $ assets = $ this -> files [ $ type ] [ $ group ] ; return $ this -> write ( $ type , $ assets , $ directory ) ; } | Generates a singular file that contains all of the specific asset files . |
17,357 | private function deriveProcessingEnabled ( ) { if ( config ( 'assetprocessor.enabled.force' , false ) ) { $ this -> processingEnabled = true ; } else { $ this -> processingEnabled = in_array ( App :: environment ( ) , config ( 'assetprocessor.enabled.environments' , array ( ) ) ) ; } } | Used internally in order to determine whether or not we need to actually process the input files . |
17,358 | private function setupLibraries ( ) { $ processors = config ( 'assetprocessor.processors.types' , array ( ) ) ; $ interface = config ( 'assetprocessor.processors.interface' ) ; foreach ( $ processors as $ name => $ class ) { $ instance = $ class :: getInstance ( $ this -> processingEnabled ) ; if ( ! ( $ instance insta... | Used internally in order to set up an instance of each of the processors that we will need . |
17,359 | private function deriveExtensionMapping ( $ name , array $ extensions ) { foreach ( $ extensions as $ extension ) { if ( ! isset ( $ this -> extensionMapping [ $ extension ] ) ) { $ this -> extensionMapping [ $ extension ] = array ( ) ; } $ this -> extensionMapping [ $ extension ] [ ] = $ name ; } } | Used internally in order to derive the list of extensions that are used by a particular processor . |
17,360 | private function write ( $ type , $ contents , $ directory = null ) { $ file = '' ; $ directory = $ directory === null ? static :: storageFolder ( ) : ( $ directory . '/' ) ; $ directory .= $ type . '/' ; if ( is_array ( $ contents ) ) { foreach ( $ contents as $ filename ) { if ( ! file_exists ( $ filename ) ) { $ fil... | Used internally in order to write all of the contents for the provided files into a single file . |
17,361 | private function autoLoadAssets ( ) { foreach ( config ( 'assetprocessor.autoload.cdn' , array ( ) ) as $ asset ) { self :: cdn ( $ asset , $ asset ) ; } foreach ( config ( 'assetprocessor.autoload.local' , array ( ) ) as $ asset ) { self :: add ( $ asset , $ asset ) ; } } | Used internally in order to help with the auto - loading of all of the assets . |
17,362 | private function setupDirectories ( ) { if ( ! file_exists ( $ dir = config ( 'assetprocessor.cache.directory' ) ) ) { mkdir ( $ dir , 0777 , true ) ; } if ( ! file_exists ( $ dir = config ( 'assetprocessor.cache.external' , config ( 'assetprocessor.cache.directory' ) ) ) ) { mkdir ( $ dir , 0777 , true ) ; } if ( ! fi... | Sets up all of the base directories that the plugin will need to run . |
17,363 | public function set ( $ key , $ value ) { if ( ! $ value instanceof EntityMapperInterface ) { throw new InvalidArgumentException ( 'Trying to add a non EntityMapper to MappersMap.' ) ; } return parent :: set ( $ key , $ value ) ; } | Puts a new Entity mapper in the map . |
17,364 | public static final function configuration ( string $ locale ) { if ( ! empty ( $ locale ) ) { Lang :: $ locale = $ locale ; } else { Lang :: $ locale = Lang :: STANDARD_LOCALE ; } return null ; } | - Define configuration locate of language |
17,365 | public static final function addRoot ( string $ package , string $ path ) { if ( ! empty ( $ package ) && ! empty ( $ path ) ) { $ dirname = realpath ( Path :: replaceOSSeparator ( $ path ) ) ; if ( is_dir ( $ dirname ) ) { Lang :: $ root [ $ package ] = $ dirname ; } } return null ; } | - Define root of find of packages |
17,366 | public static final function get ( string $ identify , string $ package , Array $ data = null ) : string { $ text = $ identify ; if ( ! empty ( $ identify ) ) { if ( $ language = Lang :: loadPackage ( $ package ) ) { if ( isset ( $ language -> { $ identify } ) ) { $ text = Lang :: replace ( $ language -> { $ identify }... | - Identify TAG and package and return text |
17,367 | private static function loadPackage ( string $ package ) : stdClass { $ language = new stdClass ( ) ; if ( ! empty ( $ package ) ) { $ filename = null ; if ( $ packageData = explode ( ":" , $ package ) ) { if ( ! empty ( $ packageData [ 0 ] ) ) { $ filename .= Lang :: $ root [ $ packageData [ 0 ] ] ; } if ( ! empty ( $... | - Identify package and load package language |
17,368 | private static function selectPackage ( string $ pathname ) : string { $ filename = $ pathname . DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR . Lang :: $ locale . ".json" ; if ( file_exists ( $ filename ) ) { $ pathname = $ filename ; } else { $ pathname .= DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR . Lan... | - Select package defined in configuration case not exist package select standard package |
17,369 | private static function replace ( string $ text , Array $ data = null ) : string { if ( ! empty ( $ text ) && count ( $ data ) ) { if ( $ metaText = ( new ReplaceText ( ) ) -> replace ( $ text , $ data ) ) { $ text = $ metaText ; } } return $ text ; } | - Replace TAGs in text |
17,370 | public function findByTypesAndNames ( array $ namesByTypes , array $ modCombinationIds = [ ] ) : array { $ queryBuilder = $ this -> entityManager -> createQueryBuilder ( ) ; $ queryBuilder -> select ( 'i' ) -> from ( Item :: class , 'i' ) ; $ index = 0 ; $ conditions = [ ] ; foreach ( $ namesByTypes as $ type => $ name... | Finds the items with the specified types and names . |
17,371 | public function findByIds ( array $ ids ) : array { $ result = [ ] ; if ( count ( $ ids ) > 0 ) { $ queryBuilder = $ this -> entityManager -> createQueryBuilder ( ) ; $ queryBuilder -> select ( 'i' ) -> from ( Item :: class , 'i' ) -> andWhere ( 'i.id IN (:ids)' ) -> setParameter ( 'ids' , array_values ( $ ids ) ) ; $ ... | Finds the items with the specified ids . |
17,372 | public function findByKeywords ( array $ keywords , array $ modCombinationIds = [ ] ) : array { $ result = [ ] ; if ( count ( $ keywords ) > 0 ) { $ queryBuilder = $ this -> entityManager -> createQueryBuilder ( ) ; $ queryBuilder -> select ( 'i' ) -> from ( Item :: class , 'i' ) ; $ index = 0 ; foreach ( $ keywords as... | Finds the items matching the specified keywords . |
17,373 | public function findRandom ( int $ numberOfItems , array $ modCombinationIds = [ ] ) : array { $ queryBuilder = $ this -> entityManager -> createQueryBuilder ( ) ; $ queryBuilder -> select ( [ 'i' , 'RAND() AS HIDDEN rand' ] ) -> from ( Item :: class , 'i' ) -> addOrderBy ( 'rand' ) -> setMaxResults ( $ numberOfItems )... | Finds random items . |
17,374 | public function removeOrphans ( ) : void { $ itemIds = $ this -> findOrphanedIds ( ) ; if ( count ( $ itemIds ) > 0 ) { $ this -> removeIds ( $ itemIds ) ; } } | Removes any orphaned items i . e . items no longer used by any recipe or combination . |
17,375 | protected function findOrphanedIds ( ) : array { $ queryBuilder = $ this -> entityManager -> createQueryBuilder ( ) ; $ queryBuilder -> select ( 'i.id AS id' ) -> from ( Item :: class , 'i' ) -> leftJoin ( 'i.modCombinations' , 'mc' ) -> leftJoin ( RecipeIngredient :: class , 'ri' , 'WITH' , 'ri.item = i.id' ) -> leftJ... | Returns the ids of orphaned machines which are no longer used by any recipe or combination . |
17,376 | protected function removeIds ( array $ itemIds ) : void { $ queryBuilder = $ this -> entityManager -> createQueryBuilder ( ) ; $ queryBuilder -> delete ( Item :: class , 'i' ) -> andWhere ( 'i.id IN (:itemIds)' ) -> setParameter ( 'itemIds' , array_values ( $ itemIds ) ) ; $ queryBuilder -> getQuery ( ) -> execute ( ) ... | Removes the items with the specified ids from the database . |
17,377 | public static function Pfw06 ( $ date1 , $ date2 , & $ gamb , & $ phib , & $ psib , & $ epsa ) { $ t ; $ t = ( ( $ date1 - DJ00 ) + $ date2 ) / DJC ; $ gamb = ( - 0.052928 + ( 10.556378 + ( 0.4932044 + ( - 0.00031238 + ( - 0.000002788 + ( 0.0000000260 ) * $ t ) * $ t ) * $ t ) * $ t ) * $ t ) * DAS2R ; $ phib = ( 84381... | - - - - - - - - - i a u P f w 0 6 - - - - - - - - - |
17,378 | public function permissions ( ) { if ( ! isset ( $ this -> permissions ) ) { $ permissionModel = $ this :: $ permissionModel ; $ this -> permissions = $ permissionModel :: whereHas ( 'roles' , function ( $ query ) { $ query -> whereHas ( 'users' , function ( $ query ) { $ query -> where ( 'id' , $ this -> id ) ; } ) ; ... | Get the user permissions . |
17,379 | public function hasAnyPermission ( $ permissions ) { $ permissions = is_array ( $ permissions ) ? $ permissions : func_get_args ( ) ; foreach ( $ permissions as $ permission ) { if ( $ this -> permissions ( ) -> contains ( 'name' , $ permission ) ) return true ; } return false ; } | Determines if user has ANY given permissions . |
17,380 | protected function cropDefaults ( $ fpSrc , $ vals ) { $ this -> debug -> groupcollapsed ( __METHOD__ ) ; if ( empty ( $ vals [ 'src_type' ] ) || empty ( $ vals [ 'src_w' ] ) || empty ( $ vals [ 'src_h' ] ) ) { $ imageInfo = $ fpSrc == 'data' ? getimagesizefromstring ( $ vals [ 'src_data' ] ) : getimagesize ( $ fpSrc )... | get default & normalize crop parameters |
17,381 | public function getConstrainedDimensions ( $ curW , $ curH , $ maxW , $ maxH ) { $ this -> debug -> groupCollapsed ( __METHOD__ ) ; $ ratio = $ curW / $ curH ; $ return = array ( 'w' => $ curW , 'h' => $ curH ) ; if ( $ return [ 'w' ] > $ maxW ) { $ this -> debug -> log ( 'fitting to maxW' ) ; $ return = array ( 'w' =>... | Get the dimensions to fit an image to maxw and maxH |
17,382 | public function hex2rgb ( $ str_hex , $ returnAsString = false , $ seperator = ',' ) { $ str_hex = preg_replace ( "/[^0-9A-Fa-f]/" , '' , $ str_hex ) ; $ rgbArray = array ( ) ; $ return = false ; if ( strlen ( $ str_hex ) == 6 ) { $ colorVal = hexdec ( $ str_hex ) ; $ rgbArray = array ( 'red' => 0xFF & ( $ colorVal >> ... | Convert a hexadecimal color code to its RGB equivalent |
17,383 | public function imagebmp ( & $ img , $ filename = false ) { $ wid = imagesx ( $ img ) ; $ hei = imagesy ( $ img ) ; $ wid_pad = str_pad ( '' , $ wid % 4 , "\0" ) ; $ size = 54 + ( $ wid + $ wid_pad ) * $ hei ; $ header = array ( 'identifier' => 'BM' , 'file_size' => $ this -> dword ( $ size ) , 'reserved' => $ this -> ... | Save 24bit BMP file |
17,384 | public function isImage ( $ filepath ) { $ this -> debug -> groupCollapsed ( __METHOD__ , $ filepath ) ; $ isImage = false ; if ( false && function_exists ( 'exif_imagetype' ) ) { $ type = exif_imagetype ( $ filepath ) ; $ isImage = ( $ type !== false && in_array ( $ type , $ this -> imagetypes ) ) ; } else { $ imageIn... | is the file a supported image? |
17,385 | public function passthru ( $ filepath , $ info = array ( ) ) { $ this -> debug -> group ( __METHOD__ ) ; $ info = array_merge ( array ( 'filename' => null , 'md5' => null , 'mime' => 'image/jpeg' , 'size' => null , ) , $ info ) ; if ( file_exists ( $ filepath ) ) { if ( empty ( $ info [ 'md5' ] ) ) { $ info [ 'md5' ] =... | Output image with headers |
17,386 | public function make ( $ items , $ total , $ pageSize = 10 ) { $ this -> total = abs ( $ total ) ; $ this -> pageSize = $ pageSize ; $ this -> items = $ items ; return $ this ; } | Make a pagination |
17,387 | public function getCurrentPage ( $ total = null ) { $ page = abs ( app ( ) -> request -> get ( 'page' , 1 ) ) ; if ( $ total ) { $ this -> total = $ total ; } $ page >= 1 || $ page = 1 ; if ( $ this -> items ) { $ totalPage = $ this -> getTotalPage ( ) ; $ page <= $ totalPage || $ page = $ totalPage ; } return $ page ;... | Return current page |
17,388 | public function getTotalPage ( ) { $ this -> pageSize > 0 || $ this -> pageSize = 10 ; $ totalPage = ceil ( $ this -> total / $ this -> pageSize ) ; $ totalPage >= 1 || $ totalPage = 1 ; return $ totalPage ; } | Return total pages |
17,389 | public function replace ( array $ elements = array ( ) ) { $ this -> elements = array ( ) ; foreach ( $ elements as $ element ) { $ this -> add ( $ element ) ; } } | Replace the contents of this bag with the specified elements |
17,390 | public function appendRoute ( Route $ route ) { if ( ! $ originalRoute = optional ( $ this -> routes ) [ $ route -> slug ( ) ] ) { return "Route {$route->slug()} not found" ; } return $ this -> routes [ $ route -> slug ( ) ] [ 'groups' ] = $ originalRoute [ 'groups' ] -> merge ( $ route -> get ( ) [ 'groups' ] ) ; } | Append additional groups to an existing Route |
17,391 | public static function isTimestamp ( $ tstamp ) { return ( ( string ) ( int ) $ tstamp === $ tstamp ) && ( $ tstamp <= PHP_INT_MAX ) && ( $ tstamp >= ~ PHP_INT_MAX ) ; } | Checks that a string is a timestamp |
17,392 | public static function isIP ( $ address ) { $ parts = explode ( '.' , $ address ) ; if ( sizeof ( $ parts ) != 4 ) { return false ; } foreach ( $ parts as $ part ) : if ( empty ( $ part ) || ! static :: number ( $ part ) || $ part > 255 ) { return false ; } endforeach ; return true ; } | Validates an ip address format |
17,393 | protected function retrieveAllFiles ( array $ paths ) { $ files = [ ] ; foreach ( $ paths as $ path ) { $ newFiles = [ ] ; try { $ newFiles = $ this -> retrieveFiles ( $ path ) ; } catch ( FileSystemException $ e ) { continue ; } finally { $ files = array_merge ( $ files , $ newFiles ) ; } } return $ files ; } | Retrieve all yaml files from an array of directories . |
17,394 | protected function retrieveFiles ( string $ directory ) : array { $ files = [ ] ; foreach ( scandir ( $ directory ) as $ file ) { $ elem = $ this -> pathHelper -> join ( $ directory , $ file ) ; if ( $ elem != '.' && $ elem != '..' && \ is_file ( $ elem ) && \ is_readable ( $ elem ) && $ this -> stringHelper -> endsWit... | Retrieve all yaml files from a directory . |
17,395 | public function has ( string $ key ) : bool { if ( strpos ( $ key , '.' ) != false ) { return $ this -> getNested ( $ key ) != null ; } return array_key_exists ( $ key , $ this -> settings ) ; } | Checks if a key is present in the settings . |
17,396 | public function get ( string $ key = null ) { if ( empty ( $ key ) ) { return $ this -> settings ; } if ( \ strpos ( $ key , '.' ) != false ) { return $ this -> getNested ( $ key ) ; } if ( $ this -> has ( $ key ) ) { return $ this -> settings [ $ key ] ; } return null ; } | Retrieves data from the settings . |
17,397 | protected function getNested ( string $ key ) { $ parts = explode ( '.' , $ key ) ; $ result = $ this -> settings [ $ parts [ 0 ] ] ; for ( $ i = 1 ; $ i < count ( $ parts ) ; ++ $ i ) { $ value = $ parts [ $ i ] ; if ( is_array ( $ result ) && array_key_exists ( $ value , $ result ) ) { $ result = $ result [ $ value ]... | Retrieves nested data from the settings . |
17,398 | public function isSameValueAs ( Locale $ other ) { return $ this -> languageCode == $ other -> languageCode && $ this -> countryCode == $ other -> countryCode ; } | Compares two Locales |
17,399 | public function format ( $ format ) { if ( ! is_string ( $ format ) ) { throw new InvalidArgumentException ( sprintf ( 'format passed must be a string' ) ) ; } $ translateNext = false ; $ escNext = false ; $ formatted = '' ; foreach ( str_split ( $ format ) as $ char ) { if ( $ escNext ) { $ formatted .= $ char ; $ esc... | Format Locale as string |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.