idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
20,100 | private function autoCommitContent ( AbstractClassContent $ content ) { foreach ( $ content -> getData ( ) as $ subcontent ) { if ( ! ( $ subcontent instanceof AbstractClassContent ) ) { continue ; } $ this -> commit ( $ subcontent ) ; } $ this -> commit ( $ content ) ; } | Auto commit content put or post in the library . |
20,101 | protected function getRequest ( $ data , $ fields , $ verb ) { $ params = [ 'q' => $ data , 'api_key' => $ this -> apiKey , 'fields' => implode ( ',' , $ fields ) ] ; $ response = $ this -> client -> get ( $ verb , [ 'query' => $ params ] ) ; return $ this -> checkResponse ( $ response ) ; } | Call Guzzle with Get Request |
20,102 | protected function bulkPost ( $ data , $ fields , $ verb = 'geocode' ) { $ params = [ 'api_key' => $ this -> apiKey , 'fields' => implode ( ',' , $ fields ) ] ; $ response = $ this -> client -> post ( $ verb , [ 'query' => $ params , 'json' => $ data ] ) ; return $ this -> checkResponse ( $ response ) ; } | Call Guzzle Post request method |
20,103 | protected function checkResponse ( Response $ response ) { $ status = $ response -> getStatusCode ( ) ; $ reason = $ response -> getReasonPhrase ( ) ; switch ( $ status ) { case '403' : throw new Exceptions \ GeocodioAuthError ( $ reason ) ; break ; case '422' : throw new Exceptions \ GeocodioDataError ( $ reason ) ; b... | Check response code and throw appropriate exception |
20,104 | private function voteForObject ( TokenInterface $ token , $ object , array $ attributes ) { if ( self :: ACCESS_GRANTED !== $ result = parent :: vote ( $ token , $ object , $ attributes ) ) { $ objectIdentity = $ this -> getClassScopeObjectIdentity ( $ object ) ; $ result = parent :: vote ( $ token , $ objectIdentity ,... | Returns the vote for the cuurent object if denied try the vote for the general object . |
20,105 | private function voteForPage ( TokenInterface $ token , Page $ page , array $ attributes ) { if ( self :: ACCESS_DENIED === $ result = $ this -> voteForObject ( $ token , $ page , $ attributes ) ) { if ( null !== $ page -> getParent ( ) ) { $ result = $ this -> voteForPage ( $ token , $ page -> getParent ( ) , $ attrib... | Returns the vote for page object recursively till root . |
20,106 | private function voteForNestedNode ( TokenInterface $ token , AbstractNestedNode $ node , array $ attributes ) { if ( self :: ACCESS_DENIED === $ result = $ this -> voteForObject ( $ token , $ node , $ attributes ) ) { if ( null !== $ node -> getParent ( ) ) { $ result = $ this -> voteForNestedNode ( $ token , $ node -... | Returns the vote for nested node object recursively till root . |
20,107 | private function voteForClassContent ( TokenInterface $ token , AbstractClassContent $ content , array $ attributes ) { if ( null === $ content -> getProperty ( 'category' ) ) { return self :: ACCESS_GRANTED ; } if ( self :: ACCESS_DENIED === $ result = $ this -> voteForObject ( $ token , $ content , $ attributes ) ) {... | Returns the vote for class content object recursively till AbstractClassContent . |
20,108 | public function setContainer ( ContainerInterface $ container = null ) { $ this -> container = $ container ; $ this -> application = null !== $ container ? $ this -> container -> get ( 'bbapp' ) : null ; } | Application s dependency injection container setters . |
20,109 | public function createBackBeeSchema ( ) { $ classes = $ this -> getBackBeeSchema ( ) ; try { $ this -> _schemaTool -> dropSchema ( $ classes ) ; $ this -> _schemaTool -> createSchema ( $ classes ) ; } catch ( \ Exception $ e ) { echo $ e -> getMessage ( ) . "\n" ; } } | Create the BackBee schema . |
20,110 | public function createBundlesSchema ( ) { foreach ( $ this -> _application -> getBundles ( ) as $ bundle ) { $ this -> createBundleSchema ( $ bundle -> getId ( ) ) ; } } | create all bundles schema . |
20,111 | public function createBundleSchema ( $ bundleName ) { if ( null === $ bundle = $ this -> _application -> getBundle ( $ bundleName ) ) { return ; } try { $ schemaTool = new SchemaTool ( $ bundle -> getEntityManager ( ) ) ; $ classes = $ this -> getBundleSchema ( $ bundle ) ; $ schemaTool -> dropSchema ( $ classes ) ; $ ... | Create the bundle schema specified in param . |
20,112 | public function updateBundlesSchema ( ) { foreach ( $ this -> _application -> getBundles ( ) as $ bundle ) { $ this -> updateBundleSchema ( $ bundle -> getId ( ) ) ; } } | update all bundles schema . |
20,113 | public function updateBundleSchema ( $ bundleName ) { if ( null === $ bundle = $ this -> _application -> getBundle ( $ bundleName ) ) { return ; } try { $ schemaTool = new SchemaTool ( $ bundle -> getEntityManager ( ) ) ; $ classes = $ this -> getBundleSchema ( $ bundle ) ; $ schemaTool -> updateSchema ( $ classes , tr... | update the bundle schema specified in param . |
20,114 | protected function _getAbsoluteRemotePath ( $ path = null ) { if ( null === $ path ) { return $ this -> _startingpath ; } $ path = str_replace ( DIRECTORY_SEPARATOR , '/' , $ path ) ; if ( null === $ parse_url = @ parse_url ( $ path ) ) { $ parse_url = array ( 'path' => $ path ) ; } return ( '/' === substr ( $ parse_ur... | Returns the absolute remote path of a file . |
20,115 | public function getItemHelper ( array $ item ) : ItemHelper { if ( $ this -> level !== 1 && $ item [ 'type' ] === 'folder' ) { return new HeaderItemHelper ( $ item ) ; } elseif ( $ this -> level === 2 || ( $ this -> level > 1 && $ this -> getPageType ( ) === 'folder' ) ) { return new DropdownItemHelper ( $ item ) ; } e... | Get an item helper for an item . |
20,116 | private function autoloadThrowWrappers ( $ namespace , $ classname ) { if ( false === is_array ( $ this -> _streamWrappers ) ) { return false ; } foreach ( $ this -> _streamWrappers as $ n => $ wrappers ) { if ( 0 === strpos ( $ namespace , $ n ) ) { $ classpath = str_replace ( array ( $ n , NAMESPACE_SEPARATOR ) , arr... | Looks for class definition throw declared wrappers according to the namespace . |
20,117 | private function autoloadThrowFilesystem ( $ namespace , $ classname ) { if ( false === is_array ( $ this -> _namespaces ) ) { return false ; } $ pathfiles = array ( ) ; if ( false === is_array ( $ this -> _includeExtensions ) || 0 == count ( $ this -> _includeExtensions ) ) { $ pathfiles [ ] = str_replace ( NAMESPACE_... | Looks for class definition using the PHP 5 . 3 standards to the namespace . |
20,118 | private function normalizeClassname ( $ classpath ) { if ( NAMESPACE_SEPARATOR == substr ( $ classpath , 0 , 1 ) ) { $ classpath = substr ( $ classpath , 1 ) ; } if ( false !== ( $ pos = strrpos ( $ classpath , NAMESPACE_SEPARATOR ) ) ) { $ namespace = substr ( $ classpath , 0 , $ pos ) ; $ classname = substr ( $ class... | Returns the namespace and the class name to be found . |
20,119 | private function registerStreams ( ) { foreach ( $ this -> _streamWrappers as $ wrappers ) { foreach ( $ wrappers as $ wrapper ) { if ( false === in_array ( $ wrapper [ 'protocol' ] , $ this -> _availableWrappers ) ) { stream_wrapper_register ( $ wrapper [ 'protocol' ] , $ wrapper [ 'classname' ] ) ; $ this -> _availab... | Registers pre - defined stream wrappers . |
20,120 | public function getStreamWrapperClassname ( $ namespace , $ protocol ) { $ namespace = ( array ) $ namespace ; $ protocol = ( array ) $ protocol ; $ result = array ( ) ; foreach ( $ this -> _streamWrappers as $ ns => $ wrappers ) { if ( true === in_array ( $ ns , $ namespace ) ) { foreach ( $ wrappers as $ wrapper ) { ... | Returns the wrappers registered for provided namespaces and protocols . |
20,121 | public function glob ( $ pattern ) { $ wrappers = $ this -> getStreamWrapperClassname ( 'BackBee\ClassContent' , 'bb.class' ) ; if ( 0 == count ( $ wrappers ) ) { return false ; } $ classnames = array ( ) ; foreach ( $ wrappers as $ classname ) { $ wrapper = new $ classname ( ) ; if ( false !== $ matchingclass = $ wrap... | Returns AClassContent whom classname matches the provided pattern . |
20,122 | public function registerNamespace ( $ namespace , $ paths ) { if ( false === isset ( $ this -> _namespaces [ $ namespace ] ) ) { $ this -> _namespaces [ $ namespace ] = array ( ) ; } $ this -> _namespaces [ $ namespace ] = array_merge ( $ this -> _namespaces [ $ namespace ] , ( array ) $ paths ) ; return $ this ; } | Registers namespace parts to look for class name . |
20,123 | public function registerListenerNamespace ( $ path ) { if ( false === isset ( $ this -> _namespaces [ 'BackBee\Event\Listener' ] ) ) { $ this -> _namespaces [ 'BackBee\Event\Listener' ] = array ( ) ; } array_unshift ( $ this -> _namespaces [ 'BackBee\Event\Listener' ] , $ path ) ; return $ this ; } | Registers listeners namespace parts to look for class name . |
20,124 | public function registerStreamWrapper ( $ namespace , $ protocol , $ classname ) { if ( ! isset ( $ this -> _namespaces [ $ namespace ] ) ) { $ this -> _namespaces [ $ namespace ] = array ( ) ; } $ this -> _streamWrappers [ $ namespace ] [ ] = array ( 'protocol' => $ protocol , 'classname' => $ classname ) ; ksort ( $ ... | Registers stream wrappers . |
20,125 | public static function onApplicationStop ( Event $ event ) { $ container = $ event -> getTarget ( ) -> getContainer ( ) ; $ eventDispatcher = $ container -> has ( 'event.dispatcher' ) ? $ container -> get ( 'event.dispatcher' ) : null ; foreach ( array_keys ( $ container -> findTaggedServiceIds ( 'bundle' ) ) as $ bund... | Occurs on bbapplication . stop event to stop every started bundles . |
20,126 | public function login ( $ username = null , $ password = null ) { if ( false === @ $ this -> cd ( ) ) { if ( true === @ $ this -> mkdir ( ) ) { @ $ this -> cd ( ) ; } else { throw new Exception \ AuthenticationException ( sprintf ( 'Unable to change dir to %s' , $ this -> _remotepath ) ) ; } } return $ this ; } | Tries to change dir to the defined remote path . An error is triggered if failed . |
20,127 | public function sendRecursive ( $ local_path , $ remote_path , $ overwrite = false ) { if ( false === is_dir ( $ local_path ) ) { return $ this -> send ( $ local_path , $ remote_path , $ overwrite ) ; } if ( false === $ lls = @ scandir ( $ local_path ) ) { return $ this -> _trigger_error ( sprintf ( 'Unable to list fil... | Copy recursively a local file and subfiles to the remote server . |
20,128 | public function isApiSignatureValid ( BBUserToken $ token , $ signaturePresented ) { return StringUtils :: equals ( $ this -> createSignature ( $ token ) , $ signaturePresented ) ; } | Checks if the presented signature is valid or not according to token . |
20,129 | public function createSignature ( BBUserToken $ token ) { return md5 ( $ token -> getUser ( ) -> getApiKeyPublic ( ) . $ token -> getUser ( ) -> getApiKeyPrivate ( ) . $ token -> getNonce ( ) ) ; } | Create a signature for a given user . |
20,130 | public function updateExpireByTag ( $ tag , $ lifetime = null , $ bypass_control = false ) { $ tags = ( array ) $ tag ; if ( 0 == count ( $ tags ) ) { return false ; } $ expire = $ this -> getExpireTime ( $ lifetime , $ bypass_control ) ; try { $ this -> _repository -> createQueryBuilder ( 'c' ) -> update ( ) -> set ( ... | Updates the expire date time for all cache records associated to one of the provided tags . |
20,131 | public function getMinExpireByTag ( $ tag , $ lifetime = 0 ) { $ tags = ( array ) $ tag ; if ( 0 == count ( $ tags ) ) { return $ lifetime ; } $ now = new \ DateTime ( ) ; $ expire = $ this -> getExpireTime ( $ lifetime ) ; try { $ min = $ this -> _repository -> createQueryBuilder ( 'c' ) -> select ( 'MIN(c._expire)' )... | Returns the minimum expire date time for all cache records associated to one of the provided tags . |
20,132 | private function getContextualTags ( array $ tags ) { foreach ( $ tags as & $ tag ) { $ tag = $ this -> getContextualId ( $ tag ) ; } unset ( $ tag ) ; return $ tags ; } | Return an array of contextual tags according to the defined prefix key . |
20,133 | private function getCacheEntity ( $ id ) { $ contextual_id = $ this -> getContextualId ( $ id ) ; if ( null === $ this -> _entity || $ this -> _entity -> getId ( ) !== $ contextual_id ) { $ this -> _entity = $ this -> _repository -> find ( $ contextual_id ) ; } return $ this -> _entity ; } | Returns the store entity for provided cache id . |
20,134 | private function resetCacheEntity ( ) { if ( null !== $ this -> _entity ) { $ this -> _em -> detach ( $ this -> _entity ) ; $ this -> _entity = null ; } } | Resets the last stored entity . |
20,135 | private function setPrefixKey ( ) { if ( null !== $ this -> getContext ( ) ) { $ this -> _prefix_key = md5 ( $ this -> getContext ( ) ) ; } return $ this ; } | Sets the cache prefix key according to the context . |
20,136 | private function setEntityRepository ( ) { try { $ this -> _repository = $ this -> _em -> getRepository ( self :: ENTITY_CLASSNAME ) ; } catch ( \ Exception $ e ) { throw new CacheException ( 'Enable to load the cache entity repository' , null , $ e ) ; } return $ this ; } | Sets the entity repository . |
20,137 | private function setEntityManager ( ) { try { if ( $ this -> _instance_options [ 'em' ] instanceof EntityManager ) { $ this -> _em = $ this -> _instance_options [ 'em' ] ; } else { $ this -> _em = EntityManagerCreator :: create ( $ this -> _instance_options [ 'dbal' ] , $ this -> getLogger ( ) ) ; } } catch ( InvalidAr... | Sets the entity manager . |
20,138 | public function getAcl ( $ objectIdentity ) { $ this -> enforceObjectIdentity ( $ objectIdentity ) ; try { $ acl = $ this -> securityContext -> getACLProvider ( ) -> createAcl ( $ objectIdentity ) ; } catch ( AclAlreadyExistsException $ e ) { $ acl = $ this -> securityContext -> getACLProvider ( ) -> findAcl ( $ object... | Get ACL for the given domain object . |
20,139 | public function insertOrUpdateClassAce ( $ objectIdentity , $ sid , $ mask , $ strategy = null ) { $ this -> enforceObjectIdentity ( $ objectIdentity ) ; $ this -> enforceSecurityIdentity ( $ sid ) ; $ mask = $ this -> resolveMask ( $ mask , $ objectIdentity ) ; $ acl = $ this -> getAcl ( $ objectIdentity ) ; $ found =... | Updates an existing Class ACE Inserts if it doesn t exist . |
20,140 | public function deleteClassAce ( $ objectIdentity , $ sid ) { $ this -> enforceObjectIdentity ( $ objectIdentity ) ; $ this -> enforceSecurityIdentity ( $ sid ) ; $ acl = $ this -> getAcl ( $ objectIdentity ) ; $ found = false ; foreach ( $ acl -> getClassAces ( ) as $ index => $ ace ) { if ( $ ace -> getSecurityIdenti... | Deletes a class - scope ACE . |
20,141 | public function getClassAce ( $ objectIdentity , $ sid ) { $ this -> enforceObjectIdentity ( $ objectIdentity ) ; $ this -> enforceSecurityIdentity ( $ sid ) ; $ acl = $ this -> securityContext -> getACLProvider ( ) -> findAcl ( $ objectIdentity ) ; foreach ( $ acl -> getClassAces ( ) as $ index => $ ace ) { if ( $ ace... | Get a class - scope ACE . |
20,142 | public function getObjectAce ( $ objectIdentity , $ sid ) { $ this -> enforceObjectIdentity ( $ objectIdentity ) ; $ this -> enforceSecurityIdentity ( $ sid ) ; $ acl = $ this -> securityContext -> getACLProvider ( ) -> findAcl ( $ objectIdentity ) ; foreach ( $ acl -> getObjectAces ( ) as $ index => $ ace ) { if ( $ a... | Get an object - scope ACE . |
20,143 | public function getMask ( array $ permissions ) { $ maskBuilder = new MaskBuilder ( ) ; foreach ( $ permissions as $ permission ) { try { $ maskBuilder -> add ( $ permission ) ; } catch ( InvalidArgumentException $ e ) { throw new InvalidPermissionException ( 'Invalid permission mask: ' . $ permission , $ permission , ... | Calculate mask for a list of permissions . |
20,144 | public function getPermissionCodes ( ) { $ permissions = [ 'view' => MaskBuilder :: MASK_VIEW , 'create' => MaskBuilder :: MASK_CREATE , 'edit' => MaskBuilder :: MASK_EDIT , 'delete' => MaskBuilder :: MASK_DELETE , 'undelete' => MaskBuilder :: MASK_UNDELETE , 'operator' => MaskBuilder :: MASK_OPERATOR , 'master' => Mas... | Get a list of all available permission codes . |
20,145 | public function getPermissionsByPage ( $ page , $ sid ) { $ objectIdentity = $ this -> getClassScopeObjectIdentity ( $ page ) ; try { $ ace = $ this -> getObjectAce ( $ objectIdentity , $ sid ) ; } catch ( \ Exception $ e ) { if ( null !== $ page -> getParent ( ) ) { return $ this -> getPermissionsByPage ( $ page -> ge... | Get permissions by page |
20,146 | private function getAccessGranted ( $ ace ) { $ access = [ 'total' => $ ace -> getMask ( ) ] ; foreach ( $ this -> getPermissionCodes ( ) as $ permission => $ code ) { $ access [ $ permission ] = ( 0 !== ( $ ace -> getMask ( ) & $ code ) ) ? 1 : 0 ; } $ access [ 'none' ] = ( 0 === $ ace -> getMask ( ) ) ? 1 : 0 ; $ acc... | Determines whether access is granted . |
20,147 | public function addServers ( array $ servers = array ( ) ) { $ result = true ; foreach ( $ servers as $ server ) { if ( false === is_array ( $ server ) ) { throw new CacheException ( 'Memcache adapter: server configuration is not an array.' ) ; } $ server = array_merge ( $ this -> _default_server , $ server ) ; $ resul... | Adds a set of servers to the memcache instance pool . |
20,148 | public function addServer ( $ host , $ port , $ weight = 0 ) { if ( true === $ this -> _hasServer ( $ host , $ port ) ) { return true ; } if ( false === $ this -> _cache -> addServer ( $ host , $ port , $ weight ) ) { return $ this -> _onError ( 'setOption' ) ; } return true ; } | Adds a server to the server pool . |
20,149 | public function load ( $ id , $ bypassCheck = true , \ DateTime $ expire = null ) { if ( null === $ expire ) { $ expire = new \ DateTime ( ) ; } $ last_timestamp = $ this -> test ( $ id ) ; if ( true === $ bypassCheck ) { $ last_timestamp = 0 ; } if ( true === $ bypassCheck || 0 === $ last_timestamp || $ expire -> getT... | Returns the available cache for the given id if found returns FALSE else . |
20,150 | protected function _hasServer ( $ host , $ port ) { $ servers = $ this -> getServerList ( ) ; foreach ( $ servers as $ server ) { if ( $ server [ 'host' ] === $ host && $ server [ 'port' ] === $ port ) { return true ; } } return false ; } | Returns TRUE if the server is already added to Memcached FALSE otherwise . |
20,151 | protected function _onError ( $ method ) { $ this -> log ( 'notice' , sprintf ( 'Error occured on Memcached::%s(): [%s] %s.' , $ method , $ this -> getResultCode ( ) , $ this -> getResultMessage ( ) ) ) ; return false ; } | Logs error result code and message . |
20,152 | public function getUrlByRoutePath ( $ route_path ) { if ( null === $ url = $ this -> getRouteCollection ( ) -> getRoutePath ( $ route_path ) ) { $ url = '/' ; } return $ url ; } | Return the url to the provided route path . |
20,153 | public function terminate ( ) { if ( ! $ this -> application || false === $ this -> application -> isStarted ( ) ) { return ; } ob_implicit_flush ( true ) ; flush ( ) ; if ( $ this -> response instanceof Response ) { $ this -> application -> getEventDispatcher ( ) -> dispatch ( KernelEvents :: TERMINATE , new PostRespo... | This method executed on shutdown after the response is sent . |
20,154 | protected function getRequestContext ( ) { if ( null === $ this -> requestContext ) { $ this -> requestContext = new RequestContext ( ) ; $ this -> requestContext -> fromRequest ( $ this -> getRequest ( ) ) ; } return $ this -> requestContext ; } | Returns the current request context . |
20,155 | private function dispatch ( $ eventName , $ controller = null , $ type = self :: MASTER_REQUEST , $ stopWithResponse = true ) { if ( null === $ this -> application ) { return ; } if ( null !== $ this -> application -> getEventDispatcher ( ) ) { $ event = new GetResponseEvent ( null === $ controller ? $ this : $ control... | Dispatches GetResponseEvent . |
20,156 | private function send ( Response $ response , $ type = self :: MASTER_REQUEST ) { if ( null !== $ this -> application && null !== $ this -> application -> getEventDispatcher ( ) ) { $ event = new FilterResponseEvent ( $ this , $ this -> getRequest ( ) , $ type , $ response ) ; $ this -> application -> getEventDispatche... | Dispatch FilterResponseEvent then send response . |
20,157 | protected function invokeAction ( $ type = self :: MASTER_REQUEST ) { $ this -> dispatch ( 'frontcontroller.request' ) ; $ request = $ this -> getRequest ( ) ; $ controllerResolver = $ this -> getApplication ( ) -> getContainer ( ) -> get ( 'controller_resolver' ) ; $ controller = $ controllerResolver -> getController ... | Invokes associated action to the current request . |
20,158 | private function getControllerActionEventName ( $ controller , $ actionName ) { if ( ! is_object ( $ controller ) ) { throw new \ InvalidArgumentException ( 'Controller must be type of object, ' . gettype ( $ controller ) . ' given.' ) ; } $ eventName = str_replace ( '\\' , '.' , strtolower ( get_class ( $ controller )... | Builds and returns controller s action event name . |
20,159 | public function addAppender ( IdentifierAppenderInterface $ appender ) { foreach ( ( array ) $ appender -> getGroups ( ) as $ group_name ) { if ( false === array_key_exists ( $ group_name , $ this -> appenders ) ) { $ this -> appenders [ $ group_name ] = array ( ) ; } $ this -> appenders [ $ group_name ] [ ] = $ append... | Add appender to current CacheIdentifierGenerator sorted it by groups names . |
20,160 | public function compute ( $ group_name , $ identifier , RendererInterface $ renderer = null ) { if ( false === $ this -> isValidGroup ( $ group_name ) ) { throw new InvalidArgumentException ( "$group_name is not a valid cache identifier appender group." ) ; } foreach ( $ this -> appenders [ $ group_name ] as $ appender... | This method will compute cache identifier with every appenders that belong to group name . |
20,161 | protected function decorateResponse ( $ response , $ method ) { if ( is_string ( $ response ) ) { $ response = $ this -> createResponse ( $ response ) ; } if ( ! ( $ response instanceof Response ) ) { throw new \ InvalidArgumentException ( sprintf ( '%s must returns a string or an object instance of %s, %s given.' , ge... | Decorate response to be sure to get Response Object |
20,162 | protected function invockeAction ( $ method , $ arguments ) { try { $ result = call_user_func_array ( [ $ this , $ method ] , $ arguments ) ; } catch ( \ Exception $ e ) { $ result = $ this -> createResponse ( sprintf ( '%s::%s - %s:%s' , get_class ( $ this ) , $ method , get_class ( $ e ) , $ e -> getMessage ( ) ) , 5... | Execute the controller method and return his response |
20,163 | protected function checkMethodExist ( $ method ) { if ( ! method_exists ( $ this , $ method ) ) { if ( $ this -> application -> isDebugMode ( ) ) { return $ this -> createResponse ( sprintf ( 'Called undefined method: %s.' , get_class ( $ this ) . '::' . $ method ) , 500 ) ; } else { throw new \ LogicException ( sprint... | check if the method exist |
20,164 | protected function throwsExceptionIfEntityNotFound ( $ entityName , $ id ) { if ( null === $ entity = $ this -> getRepository ( $ entityName ) -> find ( $ id ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Cannot find `%s` with id `%s`.' , $ entityName , $ id ) ) ; } return $ entity ; } | Tries to get entity with provided identifier and throws exception if not found . |
20,165 | public function isAncestorOf ( AbstractNestedNode $ node , $ strict = true ) { if ( true === $ strict ) { return ( ( $ node -> getRoot ( ) === $ this -> getRoot ( ) ) && ( $ node -> getLeftnode ( ) > $ this -> getLeftnode ( ) ) && ( $ node -> getRightnode ( ) < $ this -> getRightnode ( ) ) ) ; } else { return ( ( $ nod... | Is this node is an ancestor of the provided one ? |
20,166 | public function setLeftnode ( $ leftnode ) { if ( false === Numeric :: isPositiveInteger ( $ leftnode ) ) { throw new InvalidArgumentException ( 'A nested node position must be a strictly positive integer.' ) ; } $ this -> _leftnode = $ leftnode ; return $ this ; } | Sets the left position . |
20,167 | public function setRightnode ( $ rightnode ) { if ( false === Numeric :: isPositiveInteger ( $ rightnode ) ) { throw new InvalidArgumentException ( 'A nested node position must be a strictly positive integer.' ) ; } $ this -> _rightnode = $ rightnode ; return $ this ; } | Sets the right position . |
20,168 | public function parseRandom ( $ regionId = self :: REGION_EUW , OutputInterface $ output = null ) { $ hasOutput = null != $ output ; if ( $ hasOutput ) { $ output -> write ( "Parsing homepage...\t\t\t" ) ; } $ buzz = new Browser ( ) ; $ response = $ buzz -> get ( 'http://www.lolnexus.com/recent-games?filter-region=' . ... | Select the first player in the recent games list for a selected region |
20,169 | private function getDebugTraceResponse ( \ Exception $ exception , $ statusCode ) { $ request = $ this -> application -> getRequest ( ) ; $ response = ( new \ Symfony \ Component \ Debug \ ExceptionHandler ( ) ) -> createResponse ( $ exception ) ; $ response -> setStatusCode ( $ statusCode ) ; if ( in_array ( 'applicat... | Return response with debug trace . |
20,170 | private function getErrorPageResponse ( \ Exception $ exception , $ statusCode ) { $ parameter = $ this -> application -> getContainer ( ) -> getParameter ( 'error.default' ) ; if ( $ this -> application -> getContainer ( ) -> hasParameter ( 'error.' . $ statusCode ) ) { $ parameter = $ this -> application -> getContai... | Returns response for rendered error page . |
20,171 | private function getHttpStatusCode ( $ statusCode ) { if ( $ statusCode >= 100 && $ statusCode < 600 ) { return $ statusCode ; } elseif ( FrontControllerException :: BAD_REQUEST === $ statusCode || FrontControllerException :: INTERNAL_ERROR === $ statusCode || FrontControllerException :: NOT_FOUND === $ statusCode ) { ... | Returns a valid HTTP status code . |
20,172 | public function getTarget ( $ classname = null ) { if ( null === $ classname || true === $ this -> isTargetInstanceOf ( $ classname ) ) { return $ this -> target ; } throw new \ InvalidArgumentException ( sprintf ( 'Invalid target: expected `%s`, `%s` provided.' , $ classname , 'object' === gettype ( $ this -> target )... | Returns the target of the event optionally checks the class of the target . |
20,173 | public function handle ( GetResponseEvent $ event ) { $ request = $ event -> getRequest ( ) ; $ application = $ event -> getKernel ( ) -> getApplication ( ) ; if ( null !== $ application && false === $ request -> hasSession ( ) ) { $ container = $ application -> getContainer ( ) ; $ event -> getRequest ( ) -> setSessio... | Initiate session if not available then reads the SecurityContext from it . |
20,174 | public function getWorkflowStateAction ( Layout $ layout ) { $ layout_states = $ this -> getApplication ( ) -> getEntityManager ( ) -> getRepository ( 'BackBee\Workflow\State' ) -> getWorkflowStatesForLayout ( $ layout ) ; $ states = array ( 'online' => array ( ) , 'offline' => array ( ) , ) ; foreach ( $ layout_states... | Returns every workflow states associated to provided layout . |
20,175 | public function setSite ( \ BackBee \ Site \ Site $ site = null ) { $ this -> _site = $ site ; return $ this ; } | Sets the optional site . |
20,176 | public static function onInclude ( Event $ event ) { $ dispatcher = $ event -> getDispatcher ( ) ; if ( null !== $ dispatcher -> getApplication ( ) ) { if ( null === $ em = $ dispatcher -> getApplication ( ) -> getEntityManager ( ) ) { return ; } $ shortClassname = AbstractClassContent :: getShortClassname ( $ event ->... | Add discriminator values to class MetaData when a content class is loaded Occur on classcontent . include events . |
20,177 | public static function onUpdate ( Event $ event ) { $ content = $ event -> getTarget ( ) ; if ( ! ( $ content instanceof AbstractClassContent ) ) { throw new BBException ( 'Enable to update object' , BBException :: INVALID_ARGUMENT , new \ InvalidArgumentException ( sprintf ( 'Only BackBee\ClassContent\AbstractClassCon... | Occurs on classcontent . update event . |
20,178 | public static function onRemoveElementFile ( Event $ event ) { $ dispatcher = $ event -> getDispatcher ( ) ; $ application = $ dispatcher -> getApplication ( ) ; try { $ content = $ event -> getEventArgs ( ) -> getEntity ( ) ; if ( ! ( $ content instanceof ElementFile ) ) { return ; } $ includePath = array ( $ applicat... | Occurs on element . file . postremove events . |
20,179 | public static function onPostCall ( Event $ event ) { $ response = $ event -> getResponse ( ) ; if ( $ response -> headers -> get ( 'content-type' ) === 'text/html' ) { return ; } $ application = $ event -> getApplication ( ) ; $ renderer = $ application -> getRenderer ( ) ; $ content = json_decode ( $ response -> getC... | Occurs on rest . controller . classcontentcontroller . getAction . postcall events . |
20,180 | public function replaceOptContentTable ( AbstractClassContent $ content ) { if ( null === $ content -> getMainNode ( ) ) { return $ this ; } $ command = 'REPLACE' ; if ( ! $ this -> replaceSupported ) { $ this -> removeOptContentTable ( $ content ) ; $ command = 'INSERT' ; } $ meta = $ this -> _em -> getClassMetadata (... | Replaces content in optimized tables . |
20,181 | public function removeOptContentTable ( AbstractClassContent $ content ) { $ this -> getEntityManager ( ) -> createQuery ( 'DELETE FROM BackBee\ClassContent\Indexes\OptContentByModified o WHERE o._uid=:uid' ) -> setParameter ( 'uid' , $ content -> getUid ( ) ) -> execute ( ) ; return $ this ; } | Removes content from optimized table . |
20,182 | public function replaceIdxSiteContents ( Site $ site , array $ contents ) { $ contentUids = $ this -> getAClassContentUids ( $ contents ) ; return $ this -> replaceIdxSiteContentsUid ( $ site -> getUid ( ) , $ contentUids ) ; } | Replaces site - content indexes for an array of contents in a site . |
20,183 | public function removeIdxSiteContents ( Site $ site , array $ contents ) { return $ this -> removeIdxSiteContentsByUids ( $ site -> getUid ( ) , $ this -> getAClassContentUids ( $ contents ) ) ; } | Removes site - content indexes for an array of contents in a site . |
20,184 | public function replaceIdxContentContents ( array $ contents ) { $ parentUids = array ( ) ; foreach ( $ contents as $ content ) { if ( null === $ content || true === $ content -> isElementContent ( ) ) { continue ; } elseif ( true === array_key_exists ( $ content -> getUid ( ) , $ parentUids ) ) { break ; } elseif ( fa... | Replaces content - content indexes for an array of contents . |
20,185 | public function replaceIdxSiteContentsUid ( $ siteUid , array $ contentUids ) { if ( 0 < count ( $ contentUids ) ) { $ command = 'REPLACE' ; if ( ! $ this -> replaceSupported ) { $ this -> removeIdxSiteContentsByUids ( $ siteUid , $ contentUids ) ; $ command = 'INSERT' ; } $ meta = $ this -> _em -> getClassMetadata ( '... | Replaces or inserts a set of Site - Content indexes . |
20,186 | public function getDescendantsContentUids ( $ contents ) { if ( false === is_array ( $ contents ) ) { $ contents = array ( $ contents ) ; } $ meta = $ this -> _em -> getClassMetadata ( 'BackBee\ClassContent\Indexes\IdxContentContent' ) ; $ q = $ this -> _em -> getConnection ( ) -> createQueryBuilder ( ) -> select ( 'c.... | Returns an array of content uids owned by provided contents . |
20,187 | public function getNodeUids ( array $ contentUids ) { if ( empty ( $ contentUids ) ) { return [ ] ; } $ meta = $ this -> getEntityManager ( ) -> getClassMetadata ( 'BackBee\ClassContent\AbstractClassContent' ) ; $ nodeUids = $ this -> getEntityManager ( ) -> getConnection ( ) -> createQueryBuilder ( ) -> select ( 'c.no... | Returns every main node attach to the provided content uids . |
20,188 | private function removeIdxSiteContentsByUids ( $ siteUid , array $ contentUids ) { if ( 0 < count ( $ contentUids ) ) { $ this -> getEntityManager ( ) -> createQuery ( 'DELETE FROM BackBee\ClassContent\Indexes\IdxSiteContent i WHERE i.site_uid=:site_uid AND i.content_uid IN... | Removes a set of Site - Content indexes . |
20,189 | private function replaceIdxContentContentsByUids ( array $ parentUids ) { if ( 0 < count ( $ parentUids ) ) { $ command = 'REPLACE' ; if ( ! $ this -> replaceSupported ) { $ this -> _removeIdxContentContents ( array_keys ( $ parentUids ) ) ; $ command = 'INSERT' ; } $ meta = $ this -> _em -> getClassMetadata ( 'BackBee... | Replaces a set of Site - Content indexes . |
20,190 | public function _removeIdxContentContents ( array $ contentUids ) { if ( 0 < count ( $ contentUids ) ) { $ this -> getEntityManager ( ) -> createQuery ( 'DELETE FROM BackBee\ClassContent\Indexes\IdxContentContent i WHERE i.content_uid IN(:content_uids) OR i.subcontent_uid I... | Removes a set of Content - Content indexes . |
20,191 | private function executeUpdate ( $ query , array $ params = array ( ) , array $ types = array ( ) ) { $ this -> getEntityManager ( ) -> getConnection ( ) -> executeUpdate ( $ query , $ params , $ types ) ; return $ this ; } | Executes an optionally parameterized SQL query . |
20,192 | private function removeIdxContentContent ( AbstractClassContent $ content ) { $ query = 'DELETE FROM idx_content_content WHERE content_uid = :child OR subcontent_uid = :child' ; $ params = array ( 'child' => $ content -> getUid ( ) , ) ; return $ this -> executeUpdate ( $ query , $ params ) ; } | Remove stored content - content indexes from a content . |
20,193 | private function removeIdxContentPage ( AbstractClassContent $ content , Page $ page ) { $ query = 'DELETE FROM idx_page_content WHERE page_uid = :page ' . 'AND (content_uid IN (SELECT subcontent_uid FROM idx_content_content WHERE content_uid = :content) ' . 'OR content_uid IN (SELECT content_uid FROM idx_content_conte... | Remove stored page - content indexes from a content and a page . |
20,194 | private function removeIdxSite ( Page $ page ) { $ query = 'DELETE FROM idx_site_content WHERE site_uid = :site AND content_uid IN (SELECT content_uid FROM idx_page_content WHERE page_uid = :page)' ; $ params = array ( 'page' => $ page -> getUid ( ) , 'site' => $ page -> getSite ( ) -> getUid ( ) , ) ; return $ this ->... | Remove stored site - content indexes from a site and a page . |
20,195 | public function updateIdxContent ( AbstractClassContent $ content ) { $ query = 'INSERT INTO idx_content_content (content_uid, subcontent_uid) ' . '(SELECT :child, content_uid FROM content_has_subcontent WHERE parent_uid = :child) ' . 'UNION DISTINCT (SELECT parent_uid, :child FROM content_has_subcontent WHERE content_... | Replace content - content indexes for the provided content Also replace page - content indexes if content has a main node . |
20,196 | public function updateIdxPage ( Page $ page = null , AbstractClassContent $ content = null ) { if ( null === $ page ) { return $ this ; } if ( null === $ content ) { $ content = $ page -> getContentSet ( ) ; } $ query = 'INSERT INTO idx_page_content (page_uid, content_uid) ' . '(SELECT :page, subcontent_uid FROM idx_co... | Replace page - content indexes for the provided page Then replace site_content indexes . |
20,197 | private function getAClassContentUids ( array $ contents ) { $ contentUids = array ( ) ; foreach ( $ contents as $ content ) { if ( $ content instanceof AbstractClassContent && false === $ content -> isElementContent ( ) ) { $ contentUids [ ] = $ content -> getUid ( ) ; } } return $ contentUids ; } | Returns an array of AbstractClassContent uids . |
20,198 | public function removeIdxContent ( AbstractClassContent $ content ) { $ params = array ( 'content' => $ content -> getUid ( ) , ) ; return $ this -> executeUpdate ( 'DELETE FROM idx_site_content WHERE content_uid = :content' , $ params ) -> executeUpdate ( 'DELETE FROM idx_page_content WHERE content_uid = :content' , $... | Removes all stored indexes for the content . |
20,199 | public function removeIdxSiteContent ( Site $ site , AbstractClassContent $ content ) { $ query = 'DELETE FROM idx_site_content WHERE site_uid = :site AND (content_uid IN ' . '(SELECT content_uid FROM content_has_subcontent WHERE parent_uid = :content)' . 'OR content_uid = :content)' ; $ params = array ( 'site' => $ si... | Removes stored site - content indexes for a content in a site . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.