idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
20,400 | public function insertNodeAsLastChildOf ( AbstractNestedNode $ node , AbstractNestedNode $ parent ) { return $ this -> _insertNode ( $ node , $ parent , $ parent -> getRightnode ( ) ) ; } | Inserts a leaf node in a tree as last child of the provided parent node . |
20,401 | protected function _insertNode ( AbstractNestedNode $ node , AbstractNestedNode $ parent , $ newLeftNode ) { if ( $ parent -> isDescendantOf ( $ node , false ) ) { throw new InvalidArgumentException ( 'Cannot insert node in itself or one of its descendants' ) ; } if ( false === $ this -> _em -> contains ( $ parent ) ) ... | Inserts a leaf node in a tree . |
20,402 | public function getSiblings ( AbstractNestedNode $ node , $ includeNode = false , $ order = null , $ limit = null , $ start = 0 ) { return $ this -> createQueryBuilder ( 'n' ) -> andIsSiblingsOf ( $ node , ! $ includeNode , $ order , $ limit , $ start ) -> getQuery ( ) -> getResult ( ) ; } | Returns the siblings of the provided node . |
20,403 | public function getAncestors ( AbstractNestedNode $ node , $ depth = null , $ includeNode = false ) { $ q = $ this -> createQueryBuilder ( 'n' ) -> andIsAncestorOf ( $ node , ! $ includeNode ) ; if ( null !== $ depth ) { $ q -> andLevelIsUpperThan ( $ node -> getLevel ( ) - $ depth ) ; } return $ q -> orderBy ( 'n._rig... | Returns the ancestors of the provided node . |
20,404 | public function getDescendants ( AbstractNestedNode $ node , $ depth = null , $ includeNode = false ) { $ q = $ this -> createQueryBuilder ( 'n' ) -> andIsDescendantOf ( $ node , ! $ includeNode ) ; if ( null !== $ depth ) { $ q -> andLevelIsLowerThan ( $ node -> getLevel ( ) + $ depth ) ; } return $ q -> orderBy ( 'n.... | Returns the descendants of the provided node . |
20,405 | private function shiftRlValues ( AbstractNestedNode $ node , $ first , $ delta ) { $ this -> createQueryBuilder ( 'n' ) -> set ( 'n._leftnode' , 'n._leftnode + :delta' ) -> andRootIs ( $ node -> getRoot ( ) ) -> andLeftnodeIsUpperThan ( $ first ) -> setParameter ( 'delta' , $ delta ) -> update ( ) -> getQuery ( ) -> ex... | Shift part of a tree . |
20,406 | protected function detachFromTree ( AbstractNestedNode $ node ) { if ( true === $ node -> isRoot ( ) ) { return $ this ; } $ this -> refreshExistingNode ( $ node ) -> createQueryBuilder ( 'n' ) -> set ( 'n._leftnode' , 'n._leftnode - :delta_node' ) -> set ( 'n._rightnode' , 'n._rightnode - :delta_node' ) -> set ( 'n._l... | Detach node from its tree ie create a new tree from node . |
20,407 | protected function refreshExistingNode ( AbstractNestedNode $ node ) { if ( true === $ this -> _em -> contains ( $ node ) ) { $ this -> _em -> refresh ( $ node ) ; } elseif ( null === $ node = $ this -> find ( $ node -> getUid ( ) ) ) { $ this -> _em -> persist ( $ node ) ; } return $ this ; } | Refresh an existing node . |
20,408 | protected function detachOrPersistNode ( AbstractNestedNode $ node ) { if ( null !== $ refreshed = $ this -> find ( $ node -> getUid ( ) ) ) { return $ this -> detachFromTree ( $ refreshed ) -> refreshExistingNode ( $ node ) ; } if ( false === $ this -> _em -> contains ( $ node ) ) { $ this -> _em -> persist ( $ node )... | Persist a new node or detach it from tree if already exists . |
20,409 | public function preFlush ( EventArgs $ eventArgs ) { $ em = $ eventArgs -> getEntityManager ( ) ; $ uow = $ em -> getUnitOfWork ( ) ; foreach ( $ uow -> getScheduledEntityInsertions ( ) as $ entity ) { $ this -> _triggerEvent ( Events :: preFlush , $ entity , $ eventArgs ) ; } foreach ( $ uow -> getScheduledEntityUpdat... | Occur on preFlush events . |
20,410 | public function postLoad ( EventArgs $ eventArgs ) { if ( method_exists ( $ eventArgs , 'getEntity' ) ) { $ this -> _triggerEvent ( Events :: postLoad , $ eventArgs -> getEntity ( ) , $ eventArgs ) ; } } | Occur on postLoad events . |
20,411 | public function postPersist ( EventArgs $ eventArgs ) { if ( method_exists ( $ eventArgs , 'getEntity' ) ) { $ this -> _triggerEvent ( Events :: postPersist , $ eventArgs -> getEntity ( ) , $ eventArgs ) ; } } | Occur on postPersist events . |
20,412 | public function preRemove ( EventArgs $ eventArgs ) { if ( method_exists ( $ eventArgs , 'getEntity' ) ) { $ this -> _triggerEvent ( Events :: preRemove , $ eventArgs -> getEntity ( ) , $ eventArgs ) ; } } | Occur on preRemove events . |
20,413 | public function postRemove ( EventArgs $ eventArgs ) { if ( method_exists ( $ eventArgs , 'getEntity' ) ) { $ this -> _triggerEvent ( Events :: postRemove , $ eventArgs -> getEntity ( ) , $ eventArgs ) ; } } | Occur on postRemove events . |
20,414 | public function postUpdate ( EventArgs $ eventArgs ) { if ( method_exists ( $ eventArgs , 'getEntity' ) ) { $ this -> _triggerEvent ( Events :: postUpdate , $ eventArgs -> getEntity ( ) , $ eventArgs ) ; } } | Occur on postUpdate events . |
20,415 | public function prePersist ( EventArgs $ eventArgs ) { if ( method_exists ( $ eventArgs , 'getEntity' ) ) { $ this -> _triggerEvent ( Events :: prePersist , $ eventArgs -> getEntity ( ) , $ eventArgs ) ; } } | Occur on prePersist events . |
20,416 | public function preUpdate ( EventArgs $ eventArgs ) { if ( method_exists ( $ eventArgs , 'getEntity' ) ) { $ this -> _triggerEvent ( Events :: preUpdate , $ eventArgs -> getEntity ( ) , $ eventArgs ) ; } } | Occur on preUpdate events . |
20,417 | public function getValue ( $ name , $ default = 0 ) { $ current = $ this -> read ( $ name , $ default ) ; return $ this -> update ( $ name , $ current + 1 ) ; } | Get the next sequence value . |
20,418 | public function updatesAfterClone ( ) { $ this -> updateHelpers ( ) ; foreach ( $ this -> rendererAdapters -> all ( ) as $ ra ) { $ ra -> onNewRenderer ( $ this ) ; } return $ this ; } | Update every helpers and every registered renderer adapters with the right AbstractRenderer ; this method is called everytime we clone a renderer |
20,419 | public function getDefaultAdapterExt ( ) { $ managedExt = $ this -> rendererAdapters -> get ( $ this -> defaultAdapter ) -> getManagedFileExtensions ( ) ; return array_shift ( $ managedExt ) ; } | Return template file extension of the default adapter . |
20,420 | public function getResourceUrl ( $ pathinfo , Site $ site = null ) { return $ this -> getUri ( $ pathinfo , null , $ site , RouteCollection :: RESOURCE_URL ) ; } | Returns resource url . |
20,421 | protected function updatesAfterUnset ( ) { $ this -> updateHelpers ( ) ; foreach ( $ this -> rendererAdapters -> all ( ) as $ ra ) { $ ra -> onRestorePreviousRenderer ( $ this ) ; } return $ this ; } | Update every helpers and every registered renderer adapters with the right AbstractRenderer ; this method is called everytime we unset a renderer |
20,422 | private function autoloadAdapters ( ) { $ rendererConfig = $ this -> getApplication ( ) -> getConfig ( ) -> getRendererConfig ( ) ; $ adapters = ( array ) $ rendererConfig [ 'adapter' ] ; foreach ( $ adapters as $ adapter ) { $ classname = $ adapter ; $ adapterConfig = [ ] ; if ( is_array ( $ adapter ) ) { $ classname ... | Autoloads every declared renderer adapters into application config . |
20,423 | private function addManagedExtensions ( RendererAdapterInterface $ rendererAdapter ) { $ key = $ this -> getRendererAdapterKey ( $ rendererAdapter ) ; foreach ( $ rendererAdapter -> getManagedFileExtensions ( ) as $ ext ) { $ rendererAdapters = array ( $ key ) ; if ( $ this -> manageableExt -> has ( $ ext ) ) { $ rende... | Extract managed extensions from rendererAdapter and store it . |
20,424 | private function determineWhichAdapterToUse ( $ filename = null ) { if ( null === $ filename || ! is_string ( $ filename ) ) { return ; } $ pieces = explode ( '.' , $ filename ) ; if ( 1 > count ( $ pieces ) ) { return ; } $ ext = '.' . $ pieces [ count ( $ pieces ) - 1 ] ; $ adaptersForExt = $ this -> manageableExt ->... | Returns the right adapter to use according to the filename extension . |
20,425 | private function renderPage ( $ layoutFile = null , $ params = null ) { $ this -> setNode ( $ this -> getObject ( ) ) ; $ application = $ this -> getApplication ( ) ; if ( null !== $ contentSet = $ this -> getObject ( ) -> getContentSet ( ) ) { $ bbUserToken = $ application -> getBBUserToken ( ) ; $ revisionRepo = $ ap... | Render a page object . |
20,426 | private function setRenderParams ( AbstractRenderer $ render , $ params ) { if ( null !== $ params ) { $ params = ( array ) $ params ; foreach ( $ params as $ param => $ value ) { $ render -> setParam ( $ param , $ value ) ; } } } | Set parameters to a renderer object in parameter . |
20,427 | private function getBBVariable ( ) { return [ 'bb' => [ 'debug' => $ this -> getApplication ( ) -> isDebugMode ( ) , 'token' => $ this -> getApplication ( ) -> getBBUserToken ( ) , 'request' => $ this -> getApplication ( ) -> getRequest ( ) , 'routing' => $ this -> getApplication ( ) -> getRouting ( ) , 'translator' =>... | Returns default parameters that are availables in every templates . |
20,428 | private function parseProperty ( AbstractContent $ content , $ property ) { $ currentContent = $ content ; foreach ( explode ( '->' , $ property ) as $ part ) { if ( '@' === substr ( $ part , 0 , 1 ) ) { return $ this -> iconizeByParam ( $ currentContent , substr ( $ part , 1 ) ) ; } elseif ( $ currentContent -> hasEle... | Parses the content property and return the icon URL if found . |
20,429 | private function iconizeByParam ( AbstractContent $ content , $ paramName ) { if ( null === $ parameter = $ content -> getParam ( $ paramName ) ) { return null ; } if ( empty ( $ parameter [ 'value' ] ) ) { return null ; } return $ this -> getUri ( $ parameter [ 'value' ] ) ; } | Returns the icon URL from the parameter value . |
20,430 | private function getUri ( $ pathinfo , $ urlType = RouteCollection :: DEFAULT_URL ) { return $ this -> routeCollection -> getUri ( $ pathinfo , null , null , $ urlType ) ; } | Returns the icon URL . |
20,431 | public function collect ( Request $ request , Response $ response , \ Exception $ exception = null ) { $ collection = $ this -> container -> get ( 'routing' ) ; $ _routes = $ collection -> all ( ) ; $ routes = array ( ) ; foreach ( $ _routes as $ routeName => $ route ) { $ defaults = $ route -> getDefaults ( ) ; $ requ... | Collects the Information on the Route . |
20,432 | public function setCreated ( $ created ) { $ this -> created = $ created instanceof \ DateTime ? $ created -> format ( 'Y-m-d H:i:s' ) : $ created ; return $ this ; } | Sets the creation date . |
20,433 | public function isExpired ( ) { if ( null === $ this -> created || 0 === $ this -> lifetime ) { throw new \ LogicException ( 'Cannot define if token is expired, created datetime or/and lifetime are missing.' ) ; } return time ( ) > strtotime ( $ this -> created ) + $ this -> lifetime ; } | Returns true if current token is expired by comparing current timestamp with token created datetime and its max lifetime . |
20,434 | public function load ( ) { $ file = new File ( $ this -> filePath ) ; $ fileExt = $ file -> getExtension ( ) ; $ fileConfClass = $ this -> getConfigFileClass ( $ fileExt ) ; if ( class_exists ( $ fileConfClass ) ) { $ fileConf = new $ fileConfClass ( $ file ) ; return $ fileConf ; } throw new ConfNotSupportedException ... | Finds and returns the file if exists |
20,435 | public function init ( array $ containerDump = [ ] ) { if ( 0 < count ( $ containerDump ) ) { $ this -> rawDefinitions = $ containerDump [ 'services' ] ; if ( isset ( $ containerDump [ 'parameters' ] ) ) { $ this -> getParameterBag ( ) -> add ( $ containerDump [ 'parameters' ] ) ; } if ( isset ( $ containerDump [ 'alia... | ContainerProxy s constructor ; . |
20,436 | private function buildDefinition ( array $ array ) { $ definition = null ; if ( isset ( $ array [ 'parent' ] ) ) { $ definition = new DefinitionDecorator ( $ array [ 'parent' ] ) ; } else { $ definition = new Definition ( ) ; } if ( isset ( $ array [ 'synthetic' ] ) ) { $ definition -> setSynthetic ( $ array [ 'synthet... | Build a definition from the definition s array provided as current method parameter . |
20,437 | private function setDefinitionArguments ( Definition $ definition , array $ array ) { if ( true === array_key_exists ( 'arguments' , $ array ) ) { foreach ( $ array [ 'arguments' ] as $ arg ) { $ definition -> addArgument ( $ this -> convertArgument ( $ arg ) ) ; } } } | Set the definition arguments into definition object if it exists . |
20,438 | private function setDefinitionFactory ( Definition $ definition , array $ array ) { if ( isset ( $ array [ 'factory' ] ) ) { $ factory = [ ] ; foreach ( $ array [ 'factory' ] as $ argument ) { $ factory [ ] = $ this -> convertArgument ( $ argument ) ; } $ definition -> setFactory ( $ factory ) ; } } | Set the definition factory into definition object if it exists . |
20,439 | private function convertArgument ( $ argument ) { if ( is_string ( $ argument ) && 0 < strlen ( $ argument ) && '@' === $ argument [ 0 ] ) { $ argument = new Reference ( substr ( $ argument , 1 ) ) ; } return $ argument ; } | Converts a service string id into Reference if needed . |
20,440 | private function setDefinitionTags ( Definition $ definition , array $ array ) { if ( isset ( $ array [ 'tags' ] ) ) { if ( ! is_array ( $ array [ 'tags' ] ) ) { throw new InvalidArgumentException ( sprintf ( 'Parameter "tags" must be an array for service "%s".' , $ id ) ) ; } foreach ( $ array [ 'tags' ] as $ tag ) { ... | Set the definition tags into definition object if it exists . |
20,441 | private function setDefinitionMethodCalls ( Definition $ definition , array $ array ) { if ( isset ( $ array [ 'calls' ] ) ) { foreach ( $ array [ 'calls' ] as $ call ) { $ args = [ ] ; if ( isset ( $ call [ 1 ] ) ) { foreach ( $ call [ 1 ] as $ arg ) { $ args [ ] = $ this -> convertArgument ( $ arg ) ; } } $ definitio... | Set the definition method calls into definition object if it exists . |
20,442 | private function setDefinitionConfigurator ( Definition $ definition , array $ array ) { if ( isset ( $ array [ 'configurator' ] ) ) { $ configurator = $ array [ 'configurator' ] ; if ( is_array ( $ configurator ) ) { $ configurator [ 0 ] = $ this -> convertArgument ( $ configurator [ 0 ] ) ; } $ definition -> setConfi... | Set the definition configurator into definition object if it exists . |
20,443 | private function parseQueryParameters ( $ bundle , $ controller , $ action , $ query ) { $ url = '' ; if ( 0 !== count ( $ query ) ) { $ controller = ( new BundleControllerResolver ( $ this -> _renderer -> getApplication ( ) ) ) -> resolve ( $ bundle , $ controller ) ; $ methodParameters = ( new \ ReflectionMethod ( $ ... | parse query parameters to build the end of the url |
20,444 | protected function getJsMethod ( $ method ) { $ methods = [ 'get' => 'read' , 'post' => 'create' , 'put' => 'update' , 'delete' => 'delete' , ] ; return isset ( $ methods [ strtolower ( $ method ) ] ) ? $ methods [ strtolower ( $ method ) ] : 'read' ; } | Do the correspondence behind js method and http methods |
20,445 | private function checkParameters ( $ bundle , $ controller , $ action ) { $ application = $ this -> _renderer -> getApplication ( ) ; $ bundleController = ( new BundleControllerResolver ( $ application ) ) -> resolve ( $ bundle , $ controller ) ; if ( ! method_exists ( $ bundleController , $ action . 'Action' ) ) { thr... | Check if each parameters are correctly setted |
20,446 | public function connect ( $ host = null , $ port = null ) { $ this -> _host = null !== $ host ? $ host : $ this -> _host ; $ this -> _port = null !== $ port ? $ port : $ this -> _port ; if ( false === $ this -> _ssh_resource = ssh2_connect ( $ this -> _host , $ this -> _port ) ) { throw new TransportException ( sprintf... | Establish a SSH connection . |
20,447 | public function login ( $ username = null , $ password = null ) { $ this -> _username = null !== $ username ? $ username : $ this -> _username ; $ this -> _password = null !== $ password ? $ password : $ this -> _password ; if ( null === $ this -> _ssh_resource ) { throw new TransportException ( sprintf ( 'None SSH con... | Authenticate on remote server . |
20,448 | public function disconnect ( ) { if ( null !== $ this -> _ssh_resource ) { $ this -> exec ( 'echo "EXITING" && exit;' ) ; $ this -> _ssh_resource = null ; $ this -> _sftp_resource = null ; } return $ this ; } | Disconnect from the remote server and unset resources . |
20,449 | private function exec ( $ command ) { if ( null === $ this -> _ssh_resource ) { throw new TransportException ( sprintf ( 'None SSH connection available.' ) ) ; } if ( false === $ stream = ssh2_exec ( $ this -> _ssh_resource , $ command ) ) { throw new TransportException ( sprintf ( 'SSH command `%s` failed.' , $ comman... | Executes a command on remote server . |
20,450 | public function addListeners ( array $ events_config ) { foreach ( $ events_config as $ name => $ listeners ) { if ( false === array_key_exists ( 'listeners' , $ listeners ) ) { $ this -> application -> warning ( "None listener found for `$name` event." ) ; continue ; } $ listeners [ 'listeners' ] = ( array ) $ listene... | Add listener to events . |
20,451 | public function getEventNamePrefix ( $ entity ) { if ( is_object ( $ entity ) ) { $ eventPrefix = strtolower ( str_replace ( NAMESPACE_SEPARATOR , '.' , get_class ( $ entity ) ) . '.' ) ; } else { $ eventPrefix = strtolower ( str_replace ( NAMESPACE_SEPARATOR , '.' , $ entity ) . '.' ) ; } if ( $ entity instanceof \ Do... | return the normalize prefix of the eventname depending on classname . |
20,452 | private function formatEventName ( $ event_name , $ entity ) { if ( is_object ( $ entity ) ) { $ event_name = strtolower ( str_replace ( NAMESPACE_SEPARATOR , '.' , get_class ( $ entity ) ) . '.' . $ event_name ) ; if ( $ entity instanceof \ Doctrine \ ORM \ Proxy \ Proxy ) { $ prefix = str_replace ( NAMESPACE_SEPARATO... | Format the name of an event . |
20,453 | public static function onApplicationInit ( Event $ event ) { $ application = $ event -> getTarget ( ) ; $ container = $ application -> getContainer ( ) ; if ( false === $ application -> isDebugMode ( ) && false === $ container -> isRestored ( ) ) { $ containerFilename = $ container -> getParameter ( 'container.filename... | Occurs on event bbapplication . init to dump application container if debug mode is false . |
20,454 | public function updateFile ( AbstractClassContent $ file , $ newfilename , $ originalname = null , $ src = null ) { if ( false === ( $ file instanceof Image ) ) { throw new \ BackBee \ ClassContent \ Exception \ ClassContentException ( 'Invalid content type' ) ; } if ( false === $ newfilename = parent :: updateFile ( $... | Move an uploaded file to the temporary directory and update image content . |
20,455 | protected function _buildClass ( ) { $ defineData = $ this -> _extractData ( $ this -> elements ) ; $ defineParam = $ this -> parameters ; $ defineProps = $ this -> properties ; $ docBlock = '' ; foreach ( $ defineData as $ key => $ element ) { $ type = $ element [ 'type' ] ; if ( 'scalar' === $ type ) { $ type = 'stri... | Build the php code corresponding to the loading class . |
20,456 | protected function _normalizeVar ( $ var , $ includeSeparator = false ) { if ( $ includeSeparator ) { $ var = explode ( NAMESPACE_SEPARATOR , $ var ) ; } $ vars = ( array ) $ var ; $ pattern = "/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/" ; foreach ( $ vars as $ var ) { if ( $ var != '' && ! preg_match ( $ pattern , $ v... | Checks for a normalize var name . |
20,457 | public function getMediaFolderByLevels ( $ levels ) { $ qb = $ this -> createQueryBuilder ( 'mf' ) -> andWhere ( 'mf._level IN (:levels)' ) -> setParameter ( 'levels' , $ levels ) -> orderBy ( 'mf._leftnode' , 'asc' ) ; return $ qb -> getQuery ( ) -> getResult ( ) ; } | Get media folder by levels . |
20,458 | protected function onReplayFileDecrypted ( ReplayInterface $ replay , $ fileType , $ fileId , $ binary ) { if ( ReplayDownloader :: FILETYPE_KEYFRAME == $ fileType ) { echo PHP_EOL ; $ hex = strtoupper ( bin2hex ( $ binary ) ) ; if ( ! preg_match_all ( '/5475727265745F54[31|32]/' , $ hex , $ matches , PREG_OFFSET_CAPTU... | This method counts how many turrets were destroyed by a team |
20,459 | private function updateContentTable ( ) { $ metadata = $ this -> em -> getClassMetadata ( 'BackBee\ClassContent\AbstractClassContent' ) ; $ table = $ metadata -> getTableName ( ) ; $ field = $ metadata -> discriminatorColumn [ 'name' ] ; return $ this -> executeUpdate ( $ table , $ field ) ; } | Updates the content table . |
20,460 | private function updateRevisionTable ( ) { $ metadata = $ this -> em -> getClassMetadata ( 'BackBee\ClassContent\Revision' ) ; $ table = $ metadata -> getTableName ( ) ; $ field = $ metadata -> getColumnName ( '_classname' ) ; return $ this -> executeUpdate ( $ table , $ field ) ; } | Updates the revision table . |
20,461 | private function executeUpdate ( $ table , $ field ) { $ result = $ this -> em -> getConnection ( ) -> executeUpdate ( $ this -> getReplaceQuery ( $ table , $ field ) ) ; $ this -> output -> writeln ( sprintf ( ' - %d rows updated in `%s`.' , $ result , $ table ) ) ; return $ this ; } | Executes an update query and output the number of affected rows . |
20,462 | public function serialize ( ) { return \ serialize ( [ $ this -> class , $ this -> name , $ this -> queryParams , $ this -> requestParams , $ this -> default_start , $ this -> default_count , $ this -> max_count , $ this -> min_count , $ this -> param_converter_bag , $ this -> security , ] ) ; } | serialize current object . |
20,463 | public function getListenerInstance ( ) { if ( null !== $ this -> _listener && null === $ this -> listenerInstance ) { $ this -> listenerInstance = new $ this -> _listener ( ) ; } return $ this -> listenerInstance ; } | Creates an instance of the listener based on the provided namespace and return it or null if listener namespace is not setted . |
20,464 | public function setListener ( $ listener = null ) { if ( null !== $ listener && ! is_object ( $ listener ) && ! is_string ( $ listener ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Workflow state listener must be type of null, object or string, %s given.' , gettype ( $ listener ) ) ) ; } if ( null !== $ liste... | Sets the optional listener classname . |
20,465 | public function serialize ( ) { $ serialized = new \ stdClass ( ) ; $ serialized -> username = $ this -> _login ; $ serialized -> commonname = trim ( $ this -> _firstname . ' ' . $ this -> _lastname ) ; return json_encode ( $ serialized ) ; } | Serialize the user object . |
20,466 | private function generateApiPublicKey ( ) { if ( null === $ this -> _api_key_private ) { return $ this -> generateRandomApiKey ( ) -> getApiKeyPublic ( ) ; } return sha1 ( $ this -> _created -> format ( \ DateTime :: ATOM ) . $ this -> _api_key_private ) ; } | Generate an REST api public key based on the private key |
20,467 | public function generateRandomApiKey ( ) { $ this -> _api_key_private = md5 ( $ this -> _id . uniqid ( ) ) ; $ this -> _api_key_public = $ this -> generateApiPublicKey ( ) ; return $ this ; } | Generate a random Api pulbic and private key |
20,468 | private function _addHeaderRequirements ( ) { $ this -> _headerRequirements = array ( ) ; foreach ( $ this -> getRequirements ( ) as $ key => $ value ) { if ( 0 === strpos ( $ key , 'HTTP-' ) ) { $ this -> _headerRequirements [ substr ( $ key , 5 ) ] = $ value ; } } return $ this ; } | Extract header requirements . |
20,469 | public function getRequirements ( $ startingWith = null ) { if ( null === $ startingWith ) { return parent :: getRequirements ( ) ; } return ( 'HTTP-' == $ startingWith ) ? $ this -> _headerRequirements : array ( ) ; } | Returns the requirements . |
20,470 | public function matchHeaders ( $ attributes ) { $ attributes = ( array ) $ attributes ; foreach ( $ attributes as $ key => $ regexp ) { $ this -> matchHeader ( $ key , $ regexp ) ; } } | Adds checks for header attributes . |
20,471 | public function getBundles ( ) { $ bundles = [ ] ; foreach ( $ this -> getContainer ( ) -> findTaggedServiceIds ( 'bundle' ) as $ id => $ datas ) { $ bundles [ ] = $ this -> getContainer ( ) -> get ( $ id ) ; } return $ bundles ; } | returns every registered bundles . |
20,472 | public function stop ( ) { if ( $ this -> isStarted ( ) ) { $ this -> getEventDispatcher ( ) -> dispatch ( 'bbapplication.stop' , new Event ( $ this ) ) ; $ this -> info ( 'BackBee application ended' ) ; } } | Stop the current BBApplication instance . |
20,473 | public function getCacheProvider ( ) { $ conf = $ this -> getConfig ( ) -> getCacheConfig ( ) ; return isset ( $ conf [ 'provider' ] ) && is_subclass_of ( $ conf [ 'provider' ] , '\BackBee\Cache\AExtendedCache' ) ? $ conf [ 'provider' ] : '\BackBee\Cache\DAO\Cache' ; } | Get cache provider from config . |
20,474 | public function getRepository ( ) { if ( null === $ this -> repository ) { $ this -> repository = $ this -> getBaseRepository ( ) ; if ( $ this -> hasContext ( ) ) { $ this -> repository .= DIRECTORY_SEPARATOR . $ this -> context ; } } return $ this -> repository ; } | get current repository directory path |
20,475 | public function getBaseRepository ( ) { if ( null === $ this -> baseRepository ) { $ this -> baseRepository = $ this -> getBaseDir ( ) . DIRECTORY_SEPARATOR . 'repository' ; } return $ this -> baseRepository ; } | get default repository directory path |
20,476 | public function getClassContentDir ( ) { if ( null === $ this -> classcontentDir ) { $ this -> classcontentDir = [ ] ; array_unshift ( $ this -> classcontentDir , $ this -> getBBDir ( ) . '/ClassContent' ) ; array_unshift ( $ this -> classcontentDir , $ this -> getBaseRepository ( ) . '/ClassContent' ) ; if ( $ this ->... | Return the classcontent repositories path for this instance . |
20,477 | public function pushClassContentDir ( $ dir ) { File :: resolveFilepath ( $ dir ) ; $ classcontentdir = $ this -> getClassContentDir ( ) ; array_push ( $ classcontentdir , $ dir ) ; $ this -> classcontentDir = array_unique ( $ classcontentdir ) ; return $ this ; } | Push one directory at the end of classcontent dirs . |
20,478 | public function unshiftClassContentDir ( $ dir ) { File :: resolveFilepath ( $ dir ) ; $ classcontentdir = $ this -> getClassContentDir ( ) ; array_unshift ( $ classcontentdir , $ dir ) ; $ this -> classcontentDir = array_unique ( $ classcontentdir ) ; return $ this ; } | Prepend one directory at the beginning of classcontent dirs . |
20,479 | protected function initResourceDir ( ) { $ this -> resourceDir = [ ] ; $ this -> addResourceDir ( $ this -> getBBDir ( ) . '/Resources' ) ; if ( is_dir ( $ this -> getBaseRepository ( ) . '/Resources' ) ) { $ this -> addResourceDir ( $ this -> getBaseRepository ( ) . '/Resources' ) ; } if ( is_dir ( $ this -> getBaseRe... | Init the default resource directories |
20,480 | public function pushResourceDir ( $ dir ) { File :: resolveFilepath ( $ dir ) ; $ resourcedir = $ this -> getResourceDir ( ) ; array_push ( $ resourcedir , $ dir ) ; $ this -> resourceDir = $ resourcedir ; return $ this ; } | Push one directory at the end of resources dirs . |
20,481 | public function unshiftResourceDir ( $ dir ) { File :: resolveFilepath ( $ dir ) ; $ resourcedir = $ this -> getResourceDir ( ) ; array_unshift ( $ resourcedir , $ dir ) ; $ this -> resourceDir = $ resourcedir ; return $ this ; } | Prepend one directory at the begining of resources dirs . |
20,482 | public function addResourceDir ( $ dir ) { if ( null === $ this -> resourceDir ) { $ this -> initResourceDir ( ) ; } if ( ! is_array ( $ this -> resourceDir ) ) { throw new BBException ( 'Misconfiguration of the BBApplication : resource dir has to be an array' , BBException :: INVALID_ARGUMENT ) ; } if ( ! file_exists ... | Prepend one directory of resources . |
20,483 | private function initAnnotationReader ( ) { AnnotationRegistry :: registerFile ( $ this -> getVendorDir ( ) . '/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php' ) ; AnnotationRegistry :: registerAutoloadNamespaces ( [ 'JMS\Serializer\Annotation' => $ this -> getVendorDir ( ) . '/jms/serializer/src/... | register all annotations and init the AnnotationReader |
20,484 | private function initBundles ( ) { $ bundleLoader = $ this -> getContainer ( ) -> get ( 'bundle.loader' ) ; if ( ! $ bundleLoader -> isRestored ( ) && null !== $ this -> getConfig ( ) -> getBundlesConfig ( ) ) { $ bundleLoader -> load ( $ this -> getConfig ( ) -> getBundlesConfig ( ) ) ; } return $ this ; } | Loads every declared bundles into application . |
20,485 | public function onFatalError ( ) { $ error = error_get_last ( ) ; if ( null !== $ error && in_array ( $ error [ 'type' ] , [ E_ERROR , E_RECOVERABLE_ERROR ] ) ) { $ this -> error ( $ error [ 'message' ] ) ; } } | Registered function for execution on shutdown . Logs fatal error message if exists . |
20,486 | private function xml2array ( $ xmlObject , $ out = array ( ) ) { foreach ( $ xmlObject -> attributes ( ) as $ attr => $ val ) { $ out [ '@attributes' ] [ $ attr ] = ( string ) $ val ; } $ hasChilds = false ; foreach ( $ xmlObject as $ index => $ node ) { $ hasChilds = true ; $ out [ $ index ] [ ] = $ this -> xml2array ... | Converts an XML string in an array |
20,487 | private function getConfigDumpRightDirectory ( $ baseDir ) { $ configDumpDir = $ this -> app -> getBaseRepository ( ) ; if ( $ this -> persistPerContext && ApplicationInterface :: DEFAULT_CONTEXT !== $ this -> app -> getContext ( ) ) { $ configDumpDir .= DIRECTORY_SEPARATOR . $ this -> app -> getContext ( ) ; } $ confi... | Returns path to the right directory to dump and save config . yml file . |
20,488 | public function postLoad ( ) { $ data = ( array ) $ this -> _data ; foreach ( $ data as $ dataEntry ) { $ type = key ( $ dataEntry ) ; $ dataEntry = array_pop ( $ dataEntry ) ; if ( true === is_array ( $ dataEntry ) ) { $ type = key ( $ dataEntry ) ; } if ( $ type !== 'scalar' && $ type !== 'array' ) { self :: getFullC... | Initialized data on postLoad doctrine event . |
20,489 | public function last ( ) { return ( null === $ this -> getDraft ( ) ) ? $ this -> getData ( $ this -> count ( ) - 1 ) : $ this -> getDraft ( ) -> last ( ) ; } | Return the last subcontent of the set . |
20,490 | private function readFromContainer ( ContainerInterface $ container ) { $ this -> setValueIfParameterExists ( $ container , $ this -> uriPrefixes [ self :: IMAGE_URL ] , 'bbapp.routing.image_uri_prefix' ) -> setValueIfParameterExists ( $ container , $ this -> uriPrefixes [ self :: MEDIA_URL ] , 'bbapp.routing.media_uri... | Reads varibles from the applicative container . |
20,491 | public function pushRouteCollection ( array $ routes ) { foreach ( $ routes as $ name => $ route ) { if ( ! array_key_exists ( 'pattern' , $ route ) || ! array_key_exists ( 'defaults' , $ route ) ) { $ this -> log ( 'warning' , sprintf ( 'Unable to parse the route definition `%s`.' , $ name ) ) ; continue ; } $ this ->... | Pushes an array of new routes in the collection . |
20,492 | public function getRoutePath ( $ name ) { if ( null !== $ this -> get ( $ name ) ) { return $ this -> get ( $ name ) -> getPath ( ) ; } return null ; } | Returns the path associated to a route . |
20,493 | public function getUrlByRouteName ( $ name , array $ params = null , $ baseUrl = null , $ addExt = true , Site $ site = null , $ buildQuery = false ) { $ paramsToAdd = [ ] ; $ uri = $ this -> applyRouteParameters ( $ this -> getRoutePath ( $ name ) , ( array ) $ params , $ paramsToAdd ) ; $ path = $ this -> getUri ( $ ... | Returns complete url which match with routeName and routeParams ; you can also customize the base url ; by default it use current site base url . |
20,494 | private function applyRouteParameters ( $ uri , array $ parameters , array & $ additionalParams = array ( ) ) { $ result = $ uri ; foreach ( $ parameters as $ key => $ value ) { $ count = 0 ; $ result = str_replace ( '{' . $ key . '}' , $ value , $ result , $ count ) ; if ( 0 === $ count ) { $ additionalParams [ $ key ... | Applies parameters to route pattern . |
20,495 | private function addRoute ( $ name , array $ route ) { $ this -> rawRoutes [ $ name ] = $ route ; $ newRoute = new Route ( $ route [ 'pattern' ] , $ route [ 'defaults' ] , array_key_exists ( 'requirements' , $ route ) ? $ route [ 'requirements' ] : [ ] ) ; $ this -> add ( $ name , $ newRoute ) ; $ this -> log ( 'debug'... | Adds a new route to the collection . |
20,496 | private function moveDefaultRoute ( ) { $ defaultRoute = $ this -> get ( 'default' ) ; if ( null !== $ defaultRoute ) { $ this -> remove ( 'default' ) ; $ this -> add ( 'default' , $ defaultRoute ) ; } } | Ensures that the default route is always the last one in the collection . |
20,497 | private function hasRequestAvailable ( ) { return ( null !== $ this -> application && ! $ this -> application -> isClientSAPI ( ) && $ this -> application -> isStarted ( ) ) ; } | Checks is a request is available . |
20,498 | private function getUriForSite ( $ pathinfo , Site $ site = null ) { $ siteUsed = $ this -> getCurrentSite ( $ site ) ; if ( null === $ siteUsed || null === $ this -> application ) { return $ pathinfo ; } $ protocol = '' ; if ( null === parse_url ( $ siteUsed -> getServerName ( ) , PHP_URL_SCHEME ) ) { $ protocol = ( s... | Returns URI from pathinfo according to site to be reached . |
20,499 | private function getDefaultExtFromSite ( $ pathinfo , $ extension = null , Site $ site = null ) { if ( strpos ( basename ( $ pathinfo ) , '.' ) || '/' === substr ( $ pathinfo , - 1 ) ) { return $ pathinfo ; } $ siteUsed = $ this -> getCurrentSite ( $ site ) ; $ addExtension = $ extension ; if ( null === $ addExtension ... | Adds the extension provided pr the default one for a site . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.