idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
20,600 | public function findOneBy ( array $ criteria , array $ orderBy = null ) { if ( false === PageQueryBuilder :: hasJoinCriteria ( $ criteria ) && false === PageQueryBuilder :: hasJoinCriteria ( $ orderBy ) ) { return parent :: findOneBy ( $ criteria , $ orderBy ) ; } $ query = $ this -> createQueryBuilder ( 'p' ) -> addSe... | Finds a single entity by a set of criteria with automatic join on section if need due to retro - compatibility . |
20,601 | public function getAncestors ( Page $ page , $ depth = null , $ includeNode = false ) { $ q = $ this -> createQueryBuilder ( 'p' ) -> andIsAncestorOf ( $ page , ! $ includeNode , null === $ depth ? null : $ page -> getLevel ( ) - $ depth ) ; $ results = $ q -> orderBy ( $ q -> getSectionAlias ( ) . '._leftnode' , 'asc'... | Returns the ancestors of the provided page . |
20,602 | public function insertNodeAsFirstChildOf ( Page $ page , Page $ parent , $ section = false ) { return $ this -> insertNode ( $ page , $ parent , 1 , $ section ) ; } | Inserts a page in a tree at first position . |
20,603 | public function insertNodeAsLastChildOf ( Page $ page , Page $ parent , $ section = false ) { return $ this -> insertNode ( $ page , $ parent , $ this -> getMaxPosition ( $ parent ) + 1 , $ section ) ; } | Inserts a page in a tree at last position . |
20,604 | public function insertNode ( Page $ page , Page $ parent , $ position , $ section = false ) { if ( ! $ parent -> hasMainSection ( ) ) { throw new InvalidArgumentException ( 'Parent page is not a section.' ) ; } $ current_parent = $ page -> getSection ( ) ; $ page -> setParent ( $ parent ) -> setPosition ( $ position ) ... | Inserts a page in a tree . |
20,605 | private function getOrderingDescendants ( $ depth = null , $ order = [ ] ) { if ( 1 === $ depth && true === empty ( $ order ) ) { $ order = [ '_position' => 'ASC' , '_leftnode' => 'ASC' , ] ; } elseif ( true === empty ( $ order ) ) { $ order = [ '_leftnode' => 'ASC' , '_level' => 'ASC' , '_position' => 'ASC' , ] ; } re... | Returns default ordering criteria for descendants if none provided . |
20,606 | private function copy ( Page $ page , $ title = null , Page $ parent = null ) { if ( Page :: STATE_DELETED & $ page -> getState ( ) ) { throw new InvalidArgumentException ( 'Cannot duplicate a deleted page.' ) ; } $ new_page = clone $ page ; $ new_page -> setTitle ( ( null === $ title ) ? $ page -> getTitle ( ) : $ tit... | Copy a page to a new one . |
20,607 | private function updateRelatedPostCloning ( AbstractClassContent $ content , array $ cloningData , BBUserToken $ token = null ) { if ( $ content instanceof ContentSet && true === array_key_exists ( 'pages' , $ cloningData ) && true === array_key_exists ( 'contents' , $ cloningData ) && 0 < count ( $ cloningData [ 'page... | Replace subcontent of ContentSet by their clone if exist . |
20,608 | private function updateMainNodePostCloning ( AbstractClassContent $ content , array $ cloningPages , BBUserToken $ token = null ) { $ mainnode = $ content -> getMainNode ( ) ; if ( null !== $ mainnode && 0 < count ( $ cloningPages ) && true === in_array ( $ mainnode -> getUid ( ) , array_keys ( $ cloningPages ) ) ) { i... | Update mainnode of the content if need during clonage . |
20,609 | private function duplicateRecursively ( Page $ page , $ title = null , Page $ parent = null ) { if ( null !== $ parent && true === $ parent -> isDescendantOf ( $ page ) ) { throw new InvalidArgumentException ( 'Cannot recursively duplicate a page in itself' ) ; } $ children = $ this -> getDescendants ( $ page , 1 ) ; $... | Duplicate a page and its descendants . |
20,610 | public function duplicate ( Page $ page , $ title = null , Page $ parent = null , $ recursive = true , BBUserToken $ token = null ) { if ( false === $ recursive || false === $ page -> hasMainSection ( ) ) { $ new_page = $ this -> copy ( $ page , $ title , $ parent ) ; } else { $ new_page = $ this -> duplicateRecursivel... | Duplicate a page and optionnaly its descendants . |
20,611 | public function deletePage ( Page $ page ) { if ( $ page -> hasMainSection ( ) ) { $ this -> getEntityManager ( ) -> getRepository ( 'BackBee\NestedNode\Section' ) -> deleteSection ( $ page -> getSection ( ) ) ; } if ( null !== $ page -> getContentSet ( ) ) { $ this -> getEntityManager ( ) -> createQueryBuilder ( ) -> ... | Remove a page from databse . |
20,612 | public function saveWithSection ( Page $ page , Section $ currentParent = null ) { if ( $ page -> hasMainSection ( ) ) { return $ page ; } if ( false === $ this -> _em -> contains ( $ page ) ) { $ this -> _em -> persist ( $ page ) ; } $ parent = $ page -> getSection ( ) ; if ( null !== $ currentParent && $ this -> _em ... | Saves a page with a section and returns it . |
20,613 | public function getConfigServiceId ( ) { return strtolower ( str_replace ( '%bundle_service_id%' , str_replace ( '%bundle_name%' , $ this -> id , BundleInterface :: BUNDLE_SERVICE_ID_PATTERN ) , BundleInterface :: CONFIG_SERVICE_ID_PATTERN ) ) ; } | Bundle s config service id getter . |
20,614 | public function getConfigDirectory ( ) { $ directory = $ this -> baseDir . DIRECTORY_SEPARATOR . BundleInterface :: CONFIG_DIRECTORY_NAME ; if ( false === is_dir ( $ directory ) ) { $ directory = $ this -> baseDir . DIRECTORY_SEPARATOR . BundleInterface :: OLD_CONFIG_DIRECTORY_NAME ; } return $ directory ; } | Bundle base directory getter . |
20,615 | public function setEnable ( $ enable ) { $ properties = $ this -> getProperty ( ) ; $ properties [ 'enable' ] = ( boolean ) $ enable ; $ this -> getConfig ( ) -> setSection ( 'bundle' , $ properties , true ) ; return $ this ; } | enable property setter . |
20,616 | public function setCategory ( $ category ) { $ properties = $ this -> getProperty ( ) ; $ properties [ 'category' ] = ( array ) $ category ; $ this -> getConfig ( ) -> setSection ( 'bundle' , $ properties , true ) ; return $ this ; } | category property setter . |
20,617 | public function setConfigPerSite ( $ v ) { $ properties = $ this -> getProperty ( ) ; $ properties [ 'config_per_site' ] = ( boolean ) $ v ; $ this -> getConfig ( ) -> setSection ( 'bundle' , $ properties , true ) ; return $ this ; } | config_per_site property setter . |
20,618 | private function initBundleExposedActions ( ) { if ( true === $ this -> isEnabled ( ) ) { $ container = $ this -> getApplication ( ) -> getContainer ( ) ; foreach ( ( array ) $ this -> getProperty ( 'exposed_actions' ) as $ controllerId => $ actions ) { if ( false === $ container -> has ( $ controllerId ) ) { throw new... | Initialize bundle exposed actions by building exposed_actions array and exposed_actions_callback array . |
20,619 | private function formatAndInjectExposedAction ( $ controller , $ actions ) { $ controllerId = explode ( '\\' , get_class ( $ controller ) ) ; $ controllerId = str_replace ( 'controller' , '' , strtolower ( array_pop ( ( $ controllerId ) ) ) ) ; $ this -> exposedActions [ $ controllerId ] = array ( 'actions' => array ( ... | Format a valid map between controller and actions and hydrate . |
20,620 | public function setName ( $ name ) { if ( ! preg_match ( '/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/' , $ name ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Invalid name for metadata: `%s`.' , $ name ) ) ; } $ this -> name = $ name ; return $ this ; } | Sets the name of the metadata . |
20,621 | public function setAttribute ( $ attribute , $ value , $ scheme = null , $ isComputed = false ) { $ this -> attributes [ $ attribute ] = $ value ; $ this -> scheme [ $ attribute ] = $ scheme ; $ this -> is_computed [ $ attribute ] = ( true === $ isComputed ) ; return $ this ; } | Sets the value of the attribute . |
20,622 | public function isComputed ( $ attribute ) { $ attr = $ this -> getAttribute ( $ attribute ) ; return empty ( $ attr ) || $ this -> is_computed [ $ attribute ] ; } | Is the attribute is computed? |
20,623 | public function postAction ( Request $ request , $ parent = null ) { try { $ keyWordLabel = trim ( $ request -> request -> get ( 'keyword' ) ) ; $ uid = $ request -> request -> get ( 'uid' , null ) ; if ( null !== $ uid ) { $ keywordItem = $ this -> getKeywordRepository ( ) -> find ( $ uid ) ; $ keywordItem -> setKeyWo... | Create a keyword object and if a parent is provided add the keyword as its last child . |
20,624 | protected function compile ( ) { $ config = StringUtil :: deserialize ( $ this -> bs_navbarModules , true ) ; $ modules = [ ] ; $ models = $ this -> prefetchModules ( $ config ) ; foreach ( $ config as $ module ) { $ id = $ module [ 'module' ] ; if ( $ id != '' && ! $ module [ 'inactive' ] && array_key_exists ( $ id , ... | Compile the navbar . |
20,625 | protected function extractModuleIds ( $ config ) { $ ids = [ ] ; foreach ( $ config as $ index => $ module ) { if ( $ module [ 'inactive' ] ) { continue ; } $ ids [ $ index ] = intval ( $ module [ 'module' ] ) ; } return $ ids ; } | Extract module ids from navbar config . |
20,626 | protected function prefetchModules ( $ config ) { $ ids = $ this -> extractModuleIds ( $ config ) ; $ models = [ ] ; if ( $ ids ) { $ ids = implode ( ',' , $ ids ) ; $ collection = ModuleModel :: findBy ( [ 'tl_module.id IN(' . $ ids . ')' ] , [ ] ) ; if ( $ collection ) { while ( $ collection -> next ( ) ) { $ model =... | Prefetch modules . |
20,627 | public function resolveBaseAdminUrl ( $ bundleId , $ controllerId , $ actionId ) { return str_replace ( [ '%bundle_id%' , '%controller_id%' , '%action_id%' , ] , [ $ bundleId , $ controllerId , $ actionId , ] , BundleInterface :: BUNDLE_ADMIN_URL_PATTERN ) ; } | Compute the minimal Admin Base Url |
20,628 | public function getAuthProvider ( $ key ) { if ( array_key_exists ( $ key , $ this -> authproviders ) ) { return $ this -> authproviders [ $ key ] ; } throw \ InvalidArgumentException ( sprintf ( "Auth provider doesn't exists" , $ key ) ) ; } | Get auth provider . |
20,629 | private function createEncoderFactory ( array $ config ) { if ( true === array_key_exists ( 'encoders' , $ config ) ) { $ this -> _encoderfactory = new EncoderFactory ( $ config [ 'encoders' ] ) ; } return $ this ; } | Create an encoders factory if need . |
20,630 | public function save ( \ BackBee \ Bundle \ Registry $ registry ) { if ( false === $ this -> getEntityManager ( ) -> contains ( $ registry ) ) { $ this -> getEntityManager ( ) -> persist ( $ registry ) ; } $ this -> getEntityManager ( ) -> flush ( $ registry ) ; return $ registry ; } | Saves the registry entry in DB persist it if need . |
20,631 | public function mediaAction ( $ type , $ filename , $ includePath = array ( ) ) { $ includePath = array_merge ( $ includePath , array ( $ this -> application -> getStorageDir ( ) , $ this -> application -> getMediaDir ( ) ) ) ; if ( null !== $ this -> application -> getBBUserToken ( ) ) { $ includePath [ ] = $ this -> ... | Handles a media file request . |
20,632 | private function checksSectionTable ( ) { $ schemaManager = $ this -> em -> getConnection ( ) -> getSchemaManager ( ) ; $ tableName = $ this -> em -> getClassMetadata ( 'BackBee\NestedNode\Section' ) -> getTableName ( ) ; $ this -> output -> write ( sprintf ( ' - New table `%s` - ' , $ tableName ) ) ; if ( true === $ t... | Checks for existing table section throw exception if overrideExisting is set to FALSE |
20,633 | private function checksPageTable ( ) { $ schemaManager = $ this -> em -> getConnection ( ) -> getSchemaManager ( ) ; $ tableName = $ this -> em -> getClassMetadata ( 'BackBee\NestedNode\Page' ) -> getTableName ( ) ; $ this -> output -> write ( sprintf ( ' - Existing table `%s` - ' , $ tableName ) ) ; if ( false === $ s... | Checks for required fields in table page |
20,634 | private function updateNodes ( $ classname ) { $ this -> output -> writeln ( sprintf ( '<info>Updating nested data for %s.</info>' , $ classname ) ) ; if ( true === $ this -> skipNodesUpdate ) { $ this -> output -> writeln ( ' - <comment>Skipped</comment> (option --skip-nodes-update set)' ) ; return $ this ; } $ sites ... | Updates nested data from existing pages |
20,635 | private function countNodes ( $ classname ) { $ query = sprintf ( 'SELECT COUNT(%s) FROM %s' , $ this -> requiredFields [ 'uid' ] , $ this -> em -> getClassMetadata ( $ classname ) -> getTableName ( ) ) ; $ count = $ this -> em -> getConnection ( ) -> executeQuery ( $ query ) -> fetchAll ( \ PDO :: FETCH_COLUMN ) ; ret... | Returns the number of nested nodes |
20,636 | private function updateTreeNatively ( $ nodeUid , $ classname , $ leftnode = 1 , $ level = 0 ) { $ node = new \ StdClass ( ) ; $ node -> uid = $ nodeUid ; $ node -> leftnode = $ leftnode ; $ node -> rightnode = $ leftnode + 1 ; $ node -> level = $ level ; $ start = 0 ; $ numChildren = $ this -> getCountChildren ( $ nod... | Updates nodes information of a tree |
20,637 | public function getSecurityIdentities ( TokenInterface $ token ) { $ sids = parent :: getSecurityIdentities ( $ token ) ; if ( $ token -> getUser ( ) instanceof \ BackBee \ Security \ User ) { foreach ( $ token -> getUser ( ) -> getGroups ( ) as $ group ) { $ securityIdentity = new UserSecurityIdentity ( $ group -> get... | Retrieves the available security identities for the given token . |
20,638 | public function authenticate ( TokenInterface $ token ) { if ( ! $ this -> supports ( $ token ) ) { return ; } $ username = $ token -> getUsername ( ) ; if ( empty ( $ username ) ) { $ username = 'NONE_PROVIDED' ; } $ user = $ this -> _userProvider -> loadUserByUsername ( $ username ) ; if ( false === is_array ( $ user... | Authenticate a token according to the user provider . |
20,639 | private function authenticateUser ( TokenInterface $ token , UserInterface $ user ) { if ( null === $ this -> _encoderFactory ) { return $ this -> authenticateWithoutEncoder ( $ token , $ user ) ; } else { return $ this -> authenticateWithEncoder ( $ token , $ user ) ; } } | Authenticate a token accoridng to the user provided . |
20,640 | private function authenticateWithEncoder ( TokenInterface $ token , UserInterface $ user ) { try { $ classname = \ Symfony \ Component \ Security \ Core \ Util \ ClassUtils :: getRealClass ( $ user ) ; if ( true === $ this -> _encoderFactory -> getEncoder ( $ classname ) -> isPasswordValid ( $ user -> getPassword ( ) ,... | Authenticate a token according to the user provided with password encoder . |
20,641 | private function authenticateWithoutEncoder ( TokenInterface $ token , UserInterface $ user ) { if ( null !== $ user -> getSalt ( ) && call_user_func ( $ user -> getSalt ( ) , $ token -> getCredentials ( ) ) === $ user -> getPassword ( ) ) { return new UsernamePasswordToken ( $ user , $ user -> getPassword ( ) , $ user... | Authenticate a token according to the user provided without any password encoders . |
20,642 | public function getContainerValues ( & $ item ) { if ( false === is_object ( $ item ) && false === is_array ( $ item ) ) { $ item = $ this -> getContainerServices ( $ this -> getContainerParameters ( $ item ) ) ; } return $ item ; } | Giving a string try to return the container service or parameter if exists This method can be call by array_walk or array_walk_recursive . |
20,643 | private function getContainerParameters ( $ item ) { $ matches = array ( ) ; if ( preg_match ( '/^%([^%]+)%$/' , $ item , $ matches ) ) { if ( $ this -> hasParameter ( $ matches [ 1 ] ) ) { return $ this -> getParameter ( $ matches [ 1 ] ) ; } } if ( preg_match_all ( '/%([^%]+)%/' , $ item , $ matches , PREG_PATTERN_OR... | Replaces known container parameters key by their values . |
20,644 | private function getContainerServices ( $ item ) { if ( false === is_string ( $ item ) ) { return $ item ; } $ matches = array ( ) ; if ( preg_match ( '/^@([a-z0-9.-]+)$/i' , trim ( $ item ) , $ matches ) ) { if ( $ this -> has ( $ matches [ 1 ] ) ) { return $ this -> get ( $ matches [ 1 ] ) ; } } return $ item ; } | Returns the associated service to item if exists item itself otherwise . |
20,645 | public function isLoaded ( $ id ) { $ id = strtolower ( $ id ) ; return $ this -> hasInstanceOf ( $ id ) || method_exists ( $ this , 'get' . strtr ( $ id , array ( '_' => '' , '.' => '_' ) ) . 'Service' ) ; } | Returns true if the given service is loaded . |
20,646 | public function get ( $ name ) { if ( ! $ this -> definitions -> has ( $ name ) ) { $ this -> definitions -> set ( $ name , new Schema ( ) ) ; } return $ this -> definitions -> get ( $ name ) ; } | Returns the schema for the given field |
20,647 | public function setAll ( Definitions $ definitions ) { foreach ( $ definitions as $ name => $ schema ) { $ this -> set ( $ name , $ schema ) ; } } | Sets all definitions from another definitions collection . Will overwrite existing ones . |
20,648 | public function get ( $ code ) { if ( ! $ this -> responses -> has ( $ code ) ) { $ this -> responses -> set ( $ code , new Response ( $ code ) ) ; } return $ this -> responses -> get ( $ code ) ; } | Returns the reponse info for the given code |
20,649 | private function createAndPersistConversation ( $ subject ) { $ conversation = $ this -> driver -> createConversationModel ( ) ; $ conversation -> setSubject ( $ subject ) ; $ this -> driver -> persistConversation ( $ conversation ) ; return $ conversation ; } | Create and persist a conversation object . |
20,650 | private function createAndPersistConversationPerson ( ConversationInterface $ conversation , PersonInterface $ person ) { $ conversationPerson = $ this -> driver -> createConversationPersonModel ( $ conversation , $ person ) ; $ this -> driver -> persistConversationPerson ( $ conversationPerson ) ; return $ conversatio... | Create and persist a conversation person object . |
20,651 | private function createAndPersistMessage ( ConversationInterface $ conversation , PersonInterface $ sender , $ body ) { $ message = $ this -> driver -> createMessageModel ( $ conversation , $ sender , $ body ) ; $ this -> driver -> persistMessage ( $ message ) ; return $ message ; } | Create and persist a message object . |
20,652 | private function createAndPersistMessagePerson ( MessageInterface $ message , PersonInterface $ person , $ setRead ) { $ messagePerson = $ this -> driver -> createMessagePersonModel ( $ message , $ person ) ; if ( $ setRead ) { $ messagePerson -> setRead ( ) ; } $ this -> driver -> persistMessagePerson ( $ messagePerso... | Create and persist a message person object . |
20,653 | protected function getMigrationFiles ( ) { if ( $ this -> _migrationFiles === null ) { $ this -> _migrationFiles = [ ] ; $ directories = $ this -> getDirectories ( ) ; foreach ( $ directories as $ namespace => $ dir ) { if ( $ dir && is_dir ( $ dir ) ) { $ handle = opendir ( $ dir ) ; while ( ( $ file = readdir ( $ han... | List of migration class at all entire path |
20,654 | protected function getExcepts ( ) { if ( ! is_array ( $ this -> excepts ) ) { $ excepts = [ ] ; if ( ! empty ( $ this -> excepts ) ) { foreach ( preg_split ( '/\s*,\s*/' , $ this -> excepts ) as $ version ) { if ( preg_match ( '/m?(\d{6}_?\d{6})(\D.*?)?$/is' , $ version , $ matches ) ) { $ excepts [ $ matches [ 1 ] ] =... | Excepted version to be applied |
20,655 | public function actionUp ( $ limit = 0 ) { if ( is_numeric ( $ limit ) ) { return parent :: actionUp ( $ limit ) ; } else { return $ this -> actionPartialUp ( $ limit ) ; } } | Upgrades the application by applying new migrations . For example |
20,656 | public function actionDown ( $ limit = 1 ) { if ( is_numeric ( $ limit ) || $ limit === 'all' ) { return parent :: actionDown ( $ limit ) ; } else { return $ this -> actionPartialDown ( $ limit ) ; } } | Downgrades the application by reverting old migrations . For example |
20,657 | public function actionRedo ( $ limit = 1 ) { if ( is_numeric ( $ limit ) || $ limit === 'all' ) { return parent :: actionRedo ( $ limit ) ; } else { return $ this -> actionPartialRedo ( $ limit ) ; } } | Redoes the last few migrations . |
20,658 | public function actionPartialUp ( $ version ) { $ migrations = $ this -> getVersions ( 'new' , $ version ) ; if ( empty ( $ migrations ) ) { $ this -> stdout ( "No new migrations to be applied.\n" , Console :: FG_GREEN ) ; return self :: EXIT_CODE_NORMAL ; } $ n = count ( $ migrations ) ; $ this -> stdout ( "Total $n n... | Upgrades the application by applying new migration . For example |
20,659 | public function actionPartialDown ( $ version ) { $ migrations = $ this -> getVersions ( 'history' , $ version ) ; if ( empty ( $ migrations ) ) { $ this -> stdout ( "No migration has been done before.\n" , Console :: FG_GREEN ) ; return self :: EXIT_CODE_NORMAL ; } $ n = count ( $ migrations ) ; $ this -> stdout ( "To... | Downgrades the application by reverting old migration . For example |
20,660 | public function actionPartialRedo ( $ version ) { $ migrations = $ this -> getVersions ( 'history' , $ version ) ; if ( empty ( $ migrations ) ) { $ this -> stdout ( "No migration has been done before.\n" , Console :: FG_GREEN ) ; return self :: EXIT_CODE_NORMAL ; } $ n = count ( $ migrations ) ; $ this -> stdout ( "To... | Redoes partial migration . |
20,661 | public function exec ( array $ req = [ ] ) { usleep ( 250000 ) ; $ req [ 'apikey' ] = $ this -> apiKeyToken ; $ postData = http_build_query ( $ req , '' , '&' ) ; if ( is_null ( self :: $ ch ) ) { self :: $ ch = curl_init ( ) ; curl_setopt ( self :: $ ch , CURLOPT_RETURNTRANSFER , true ) ; curl_setopt ( self :: $ ch , ... | Executes curl request to the Etherscan API . |
20,662 | private function createConversationQueryBuilder ( ) { return $ this -> objectManager -> createQueryBuilder ( ) -> select ( 'c' , 'cp' , 'p' , 't' , 'm' , 'mp' ) -> from ( $ this -> getConversationClass ( ) , 'c' ) -> leftJoin ( 'c.persons' , 'cp' ) -> leftJoin ( 'cp.person' , 'p' ) -> leftJoin ( 'cp.tags' , 't' ) -> le... | Create a conversation query builder with optimized joins . |
20,663 | public function get ( $ id ) { if ( ! $ this -> schemes -> has ( $ id ) ) { $ this -> schemes -> set ( $ id , new SecurityScheme ( $ id ) ) ; } return $ this -> schemes -> get ( $ id ) ; } | Returns the scheme info for the given id |
20,664 | public function searchByName ( $ name ) { return $ this -> parameters -> search ( $ name , function ( Parameter $ param , $ name ) { return $ param -> getName ( ) == $ name ; } ) ; } | Searches whether a parameter with the given name exists |
20,665 | public function findByName ( $ name ) { foreach ( $ this -> parameters as $ param ) { if ( $ param -> getName ( ) == $ name ) { return $ param ; } } } | Returns parameter with the given name if it exists |
20,666 | public function getByName ( $ name ) { $ param = $ this -> findByName ( $ name ) ; if ( empty ( $ param ) ) { $ param = new Parameter ( ) ; $ param -> setName ( $ name ) ; $ this -> parameters -> add ( $ param ) ; } return $ param ; } | Searches for the parameter with the given name . Creates a parameter with the given name if none exists |
20,667 | public function search ( $ name , $ in ) { return $ this -> parameters -> search ( function ( Parameter $ param ) use ( $ name , $ in ) { return $ param -> getIn ( ) == $ in && $ param -> getName ( ) == $ name ; } ) ; } | Searches whether a parameter with the given unique combination exists |
20,668 | protected function parse ( $ pattern , $ route , $ params ) { $ pattern = ltrim ( $ pattern , '/' ) ; if ( preg_match_all ( self :: REGEX , $ pattern , $ matches , PREG_OFFSET_CAPTURE | PREG_SET_ORDER ) ) { $ regex = '~^' ; $ variables = [ ] ; $ offset = 0 ; $ i = 1 ; foreach ( $ matches as $ match ) { if ( $ match [ 0... | Parses a route string that does not contain optional segments . |
20,669 | public function get ( $ path ) { if ( ! $ this -> paths -> has ( $ path ) ) { $ this -> paths -> set ( $ path , new Path ( $ path ) ) ; } return $ this -> paths -> get ( $ path ) ; } | Returns the path info for the given path |
20,670 | public function add ( Path $ path ) { $ this -> paths -> set ( $ path -> getPath ( ) , $ path ) ; return $ this ; } | Sets the path |
20,671 | public function addAll ( Paths $ paths ) { foreach ( $ paths as $ p ) { $ path = $ this -> get ( $ p -> getPath ( ) ) ; foreach ( $ p -> getMethods ( ) as $ method ) { $ path -> setOperation ( $ method , $ p -> getOperation ( $ method ) ) ; } } } | Adds all operations from another paths collection . Will overwrite existing operations . |
20,672 | public function registerScript ( ) { ChosenBootstrapAsset :: register ( $ this -> getView ( ) ) ; $ clientOptions = Json :: encode ( $ this -> clientOptions ) ; $ id = $ this -> options [ 'id' ] ; $ this -> getView ( ) -> registerJs ( "jQuery('#$id').chosen({$clientOptions});" ) ; } | Registers chosen . js |
20,673 | public function registerHamlCompiler ( ) { $ this -> app [ 'view.engine.resolver' ] -> register ( 'haml' , function ( ) { return new CompilerEngine ( $ this -> app [ 'Bkwld\LaravelHaml\HamlCompiler' ] ) ; } ) ; $ this -> app [ 'view' ] -> addExtension ( 'haml' , 'haml' ) ; $ this -> app [ 'view' ] -> addExtension ( 'ha... | Register the regular haml compiler |
20,674 | public function registerHamlBladeCompiler ( ) { $ this -> app [ 'view.engine.resolver' ] -> register ( 'haml.blade' , function ( ) { return new CompilerEngine ( $ this -> app [ 'Bkwld\LaravelHaml\HamlBladeCompiler' ] ) ; } ) ; $ this -> app [ 'view' ] -> addExtension ( 'haml.blade' , 'haml.blade' ) ; $ this -> app [ 'v... | Register the blade compiler compiler |
20,675 | public function close ( ) { if ( isset ( $ this -> serial ) ) { dio_close ( $ this -> serial ) ; unset ( $ this -> serial ) ; } return true ; } | Close connection to serial port |
20,676 | public function read ( $ length = self :: DEFAULT_LENGTH ) { $ bytes = dio_read ( $ this -> serial , $ length ) ; return $ bytes ; } | Read data from serial port |
20,677 | public function write ( $ data , $ length = self :: DEFAULT_LENGTH , $ wait = self :: DEFAULT_WAIT ) { $ bytes = dio_write ( $ this -> serial , $ data ) ; usleep ( $ wait ) ; return $ bytes ; } | Write data to serial port |
20,678 | private function parseIniSize ( $ value ) { $ units = [ 'k' => 1024 , 'm' => 1048576 , 'g' => 1073741824 ] ; $ unit = strtolower ( substr ( $ value , - 1 ) ) ; if ( is_numeric ( $ unit ) || ! isset ( $ units [ $ unit ] ) ) { return $ value ; } return ( ( int ) $ value ) * $ units [ $ unit ] ; } | Parses ini size |
20,679 | public function getOperation ( $ method ) { if ( ! $ this -> operations -> has ( $ method ) ) { $ this -> operations -> set ( $ method , new Operation ( ) ) ; } return $ this -> operations -> get ( $ method ) ; } | Gets the operation for the given method creates one if none exists |
20,680 | public function balance ( $ address , $ tag = EtherscanAPIConf :: TAG_LATEST ) { return $ this -> request -> exec ( [ 'module' => "account" , 'action' => "balance" , 'address' => $ address , 'tag' => $ tag ] ) ; } | Get Ether Balance for a single Address . |
20,681 | public function balanceMulti ( $ addresses , $ tag = EtherscanAPIConf :: TAG_LATEST ) { if ( is_array ( $ addresses ) ) { $ addresses = implode ( "," , $ addresses ) ; } return $ this -> request -> exec ( [ 'module' => "account" , 'action' => "balancemulti" , 'address' => $ addresses , 'tag' => $ tag ] ) ; } | Get Ether Balance for multiple Addresses in a single call . |
20,682 | public function getMinedBlocks ( $ address , $ blockType = EtherscanAPIConf :: BLOCK_TYPE_BLOCKS , $ page = null , $ offset = null ) { if ( ! in_array ( $ blockType , EtherscanAPIConf :: $ blockTypes ) ) { throw new \ Exception ( "Invalid block type" ) ; } $ params = [ 'module' => "account" , 'action' => "getminedblock... | Get list of Blocks Mined by Address . |
20,683 | public function get ( $ id ) { if ( ! $ this -> securities -> has ( $ id ) ) { $ this -> securities -> set ( $ id , new Set ( ) ) ; } return $ this -> securities -> get ( $ id ) ; } | Returns the scopes for the given id |
20,684 | public function forget ( $ key ) { $ this -> database -> table ( $ this -> config [ 'db_table' ] ) -> where ( 'setting_key' , $ key ) -> delete ( ) ; $ this -> cache -> forget ( $ key ) ; } | Remove a setting |
20,685 | protected function minifyDirectToOutput ( $ js , $ options ) { $ this -> initialize ( $ js , $ options ) ; $ this -> loop ( ) ; $ this -> clean ( ) ; } | Processes a javascript string and outputs only the required characters stripping out all unneeded characters . |
20,686 | protected function initialize ( $ js , $ options ) { $ this -> options = array_merge ( static :: $ defaultOptions , $ options ) ; $ js = str_replace ( "\r\n" , "\n" , $ js ) ; $ js = str_replace ( '/**/' , '' , $ js ) ; $ this -> input = str_replace ( "\r" , "\n" , $ js ) ; $ this -> input .= PHP_EOL ; $ this -> a = "\... | Initializes internal variables normalizes new lines |
20,687 | protected function clean ( ) { unset ( $ this -> input ) ; $ this -> index = 0 ; $ this -> a = $ this -> b = '' ; unset ( $ this -> c ) ; unset ( $ this -> options ) ; } | Resets attributes that do not need to be stored between requests so that the next request is ready to go . Another reason for this is to make sure the variables are cleared and are not taking up memory . |
20,688 | protected function processOneLineComments ( $ startIndex ) { $ thirdCommentString = substr ( $ this -> input , $ this -> index , 1 ) ; $ this -> getNext ( "\n" ) ; if ( $ thirdCommentString === '@' ) { $ endPoint = $ this -> index - $ startIndex ; unset ( $ this -> c ) ; $ char = "\n" . substr ( $ this -> input , $ sta... | Removed one line comments with the exception of some very specific types of conditional comments . |
20,689 | protected function processMultiLineComments ( $ startIndex ) { $ this -> getChar ( ) ; $ thirdCommentString = $ this -> getChar ( ) ; if ( $ this -> getNext ( '*/' ) ) { $ this -> getChar ( ) ; $ this -> getChar ( ) ; $ char = $ this -> getChar ( ) ; if ( ( $ this -> options [ 'flaggedComments' ] && $ thirdCommentStrin... | Skips multiline comments where appropriate and includes them where needed . Conditional comments and license style blocks are preserved . |
20,690 | protected function getNext ( $ string ) { $ pos = strpos ( $ this -> input , $ string , $ this -> index ) ; if ( $ pos === false ) { return false ; } $ this -> index = $ pos ; return substr ( $ this -> input , $ this -> index , 1 ) ; } | Pushes the index ahead to the next instance of the supplied string . If it is found the first character of the string is returned and the index is set to it s position . |
20,691 | protected function saveString ( ) { $ startpos = $ this -> index ; $ this -> a = $ this -> b ; if ( $ this -> a !== "'" && $ this -> a !== '"' ) { return ; } $ stringType = $ this -> a ; echo $ this -> a ; while ( true ) { $ this -> a = $ this -> getChar ( ) ; switch ( $ this -> a ) { case $ stringType : break 2 ; case... | When a javascript string is detected this function crawls for the end of it and saves the whole string . |
20,692 | protected function saveRegex ( ) { echo $ this -> a . $ this -> b ; while ( ( $ this -> a = $ this -> getChar ( ) ) !== false ) { if ( $ this -> a === '/' ) { break ; } if ( $ this -> a === '\\' ) { echo $ this -> a ; $ this -> a = $ this -> getChar ( ) ; } if ( $ this -> a === "\n" ) { throw new \ RuntimeException ( '... | When a regular expression is detected this function crawls for the end of it and saves the whole regex . |
20,693 | protected function lock ( $ js ) { $ lock = '"LOCK---' . crc32 ( time ( ) ) . '"' ; $ matches = array ( ) ; preg_match ( '/([+-])(\s+)([+-])/S' , $ js , $ matches ) ; if ( empty ( $ matches ) ) { return $ js ; } $ this -> locks [ $ lock ] = $ matches [ 2 ] ; $ js = preg_replace ( '/([+-])\s+([+-])/S' , "$1{$lock}$2" , ... | Replace patterns in the given string and store the replacement |
20,694 | protected function unlock ( $ js ) { if ( empty ( $ this -> locks ) ) { return $ js ; } foreach ( $ this -> locks as $ lock => $ replacement ) { $ js = str_replace ( $ lock , $ replacement , $ js ) ; } return $ js ; } | Replace locks with the original characters |
20,695 | protected static function getEntityFullName ( \ ReflectionClass $ headRefClass , $ name = null ) { if ( $ name && $ name [ 0 ] !== "\\" ) { $ ns = $ headRefClass -> getNamespaceName ( ) ; if ( $ ns ) { $ name = $ ns . "\\" . $ name ; } } else { $ name = $ headRefClass -> getName ( ) ; } if ( substr ( $ name , 0 , 15 ) ... | Doctrine replaces Entity class with Proxy class so remove proxy namespace from results . |
20,696 | protected function createEntityManager ( ConfigRepository $ config ) { if ( ! isset ( $ config [ 'doctrine' ] ) ) { throw new Exception ( 'Doctrine configuration not registered.' ) ; } if ( ! isset ( $ config [ 'database' ] ) ) { throw new Exception ( 'Database configuration not registered.' ) ; } $ doctrineConfig = $ ... | Creates the Doctrine entity manager instance . |
20,697 | protected function createConnectionConfig ( array $ doctrineConfig , array $ databaseConfig ) { $ connectionName = array_get ( $ doctrineConfig , 'connection' , $ databaseConfig [ 'default' ] ) ; $ connectionConfig = array_get ( $ databaseConfig [ 'connections' ] , $ connectionName ) ; if ( $ connectionConfig === null ... | Creates the Doctrine connection configuration . |
20,698 | protected function normalizeConnectionConfig ( array $ config ) { $ adapter = $ this -> createConfigurationAdapter ( $ config [ 'driver' ] ) ; $ configuration = new ConnectionConfiguration ( $ adapter ) ; return $ configuration -> map ( $ config ) ; } | Normalizes the connection config to a format Doctrine can use . |
20,699 | protected function createMetadataConfiguration ( $ type , $ paths , $ isDevMode , $ proxyDir , $ cache , $ useSimpleAnnotationReader = true ) { switch ( $ type ) { case self :: METADATA_ANNOTATIONS : return Setup :: createAnnotationMetadataConfiguration ( $ paths , $ isDevMode , $ proxyDir , $ cache , $ useSimpleAnnota... | Creates the metadata configuration instance . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.