idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
39,400 | private function groupByScheme ( SearchResult $ urls ) { $ grouped = [ ] ; foreach ( $ urls as $ url ) { $ scheme = parse_url ( $ url -> url , PHP_URL_SCHEME ) ; if ( ! $ scheme ) { continue ; } if ( ! isset ( $ grouped [ $ scheme ] ) ) { $ grouped [ $ scheme ] = [ ] ; } $ grouped [ $ scheme ] [ ] = $ url ; } return $ ... | Group URLs by schema . |
39,401 | public function initializeWithConstraints ( array $ constraints ) { $ this -> errors = array ( ) ; foreach ( $ this -> constraints as $ constraint => $ value ) { $ this -> constraints [ $ constraint ] = false ; } foreach ( $ constraints as $ constraint => $ value ) { if ( ! isset ( $ this -> constraints [ $ constraint ... | Initialized an instance of Validator with earlier configured constraints . |
39,402 | public function loadUserByToken ( $ hash ) { $ data = $ this -> userGateway -> loadUserByToken ( $ hash ) ; if ( empty ( $ data ) ) { throw new NotFound ( 'user' , $ hash ) ; } return $ this -> mapper -> mapUser ( reset ( $ data ) ) ; } | Loads user with user hash . |
39,403 | public function createRoleDraft ( $ roleId ) { $ createStruct = $ this -> mapper -> createCreateStructFromRole ( $ this -> loadRole ( $ roleId ) ) ; return $ this -> internalCreateRole ( $ createStruct , $ roleId ) ; } | Creates a draft of existing defined role . |
39,404 | protected function internalCreateRole ( RoleCreateStruct $ createStruct , $ roleId = null ) { $ createStruct = clone $ createStruct ; $ role = $ this -> mapper -> createRoleFromCreateStruct ( $ createStruct ) ; $ role -> id = $ roleId ; $ role -> status = Role :: STATUS_DRAFT ; $ this -> roleGateway -> createRole ( $ r... | Internal method for creating Role . |
39,405 | public function publishRoleDraft ( $ roleDraftId ) { $ roleDraft = $ this -> loadRole ( $ roleDraftId , Role :: STATUS_DRAFT ) ; try { $ originalRoleId = $ roleDraft -> originalId ; $ role = $ this -> loadRole ( $ originalRoleId ) ; $ roleAssignments = $ this -> loadRoleAssignmentsByRoleId ( $ role -> id ) ; $ this -> ... | Publish the specified role draft . |
39,406 | public function addPolicyByRoleDraft ( $ roleId , Policy $ policy ) { $ legacyPolicy = clone $ policy ; $ legacyPolicy -> originalId = $ policy -> id ; $ this -> limitationConverter -> toLegacy ( $ legacyPolicy ) ; $ this -> roleGateway -> addPolicy ( $ roleId , $ legacyPolicy ) ; $ policy -> id = $ legacyPolicy -> id ... | Adds a policy to a role draft . |
39,407 | public function updatePolicy ( Policy $ policy ) { $ policy = clone $ policy ; $ this -> limitationConverter -> toLegacy ( $ policy ) ; $ this -> roleGateway -> removePolicyLimitations ( $ policy -> id ) ; $ this -> roleGateway -> addPolicyLimitations ( $ policy -> id , $ policy -> limitations === '*' ? array ( ) : $ p... | Update a policy . |
39,408 | public function assignRole ( $ contentId , $ roleId , array $ limitation = null ) { $ limitation = $ limitation ? : array ( '' => array ( '' ) ) ; $ this -> userGateway -> assignRole ( $ contentId , $ roleId , $ limitation ) ; } | Assigns role to a user or user group with given limitations . |
39,409 | public function loadRoleAssignmentsByRoleId ( $ roleId ) { $ data = $ this -> roleGateway -> loadRoleAssignmentsByRoleId ( $ roleId ) ; if ( empty ( $ data ) ) { return array ( ) ; } return $ this -> mapper -> mapRoleAssignments ( $ data ) ; } | Loads roles assignments Role . |
39,410 | public function createLocationsFromNodeAssignments ( $ contentId , $ versionNo ) { $ query = $ this -> handler -> createSelectQuery ( ) ; $ query -> select ( '*' ) -> from ( $ this -> handler -> quoteTable ( 'eznode_assignment' ) ) -> where ( $ query -> expr -> lAnd ( $ query -> expr -> eq ( $ this -> handler -> quoteC... | Create locations from node assignments . |
39,411 | public function listTrashed ( $ offset , $ limit , array $ sort = null ) { $ query = $ this -> handler -> createSelectQuery ( ) ; $ query -> select ( '*' ) -> from ( $ this -> handler -> quoteTable ( 'ezcontentobject_trash' ) ) ; $ sort = $ sort ? : array ( ) ; foreach ( $ sort as $ condition ) { $ sortDirection = $ co... | List trashed items . |
39,412 | public function loadAllLocationsData ( $ offset , $ limit ) { $ query = $ this -> getAllLocationsQueryBuilder ( [ 'node_id' , 'priority' , 'is_hidden' , 'is_invisible' , 'remote_id' , 'contentobject_id' , 'parent_node_id' , 'path_identification_string' , 'path_string' , 'depth' , 'sort_field' , 'sort_order' , ] ) -> se... | Load data of every Location except the Root node . |
39,413 | private function getAllLocationsQueryBuilder ( array $ columns ) { $ query = $ this -> connection -> createQueryBuilder ( ) ; $ query -> select ( $ columns ) -> from ( 'ezcontentobject_tree' ) -> where ( $ query -> expr ( ) -> neq ( 'node_id' , 'parent_node_id' ) ) ; return $ query ; } | Get Query Builder for fetching data of all Locations except the Root node . |
39,414 | private function createNodeQueryBuilder ( array $ translations = null , bool $ useAlwaysAvailable = true ) : QueryBuilder { $ queryBuilder = $ this -> connection -> createQueryBuilder ( ) ; $ queryBuilder -> select ( 't.*' ) -> from ( 'ezcontentobject_tree' , 't' ) ; if ( ! empty ( $ translations ) ) { $ dbPlatform = $... | Create QueryBuilder for selecting node data . |
39,415 | public function getItem ( $ identifier ) { if ( isset ( $ this -> registry [ $ identifier ] ) ) { return $ this -> registry [ $ identifier ] ; } throw new NotFoundException ( 'Migration file lister' , $ identifier ) ; } | Returns the FileListerInterface matching the argument . |
39,416 | public function logCall ( string $ method , array $ arguments = [ ] ) : void { ++ $ this -> stats [ 'uncached' ] ; if ( ! $ this -> logCalls ) { return ; } $ this -> collectCacheCallData ( $ method , $ arguments , \ array_slice ( \ debug_backtrace ( DEBUG_BACKTRACE_IGNORE_ARGS , 9 ) , 2 ) , 'uncached' ) ; } | Log uncached SPI calls with method name and arguments . |
39,417 | public function logCacheMiss ( array $ arguments = [ ] , int $ traceOffset = 2 ) : void { ++ $ this -> stats [ 'miss' ] ; if ( ! $ this -> logCalls ) { return ; } $ trace = \ debug_backtrace ( DEBUG_BACKTRACE_IGNORE_ARGS , 8 + $ traceOffset ) ; $ this -> collectCacheCallData ( $ trace [ $ traceOffset - 1 ] [ 'class' ] ... | Log Cache miss gets info it needs by backtrace if needed . |
39,418 | public function logCacheHit ( array $ arguments = [ ] , int $ traceOffset = 2 , bool $ inMemory = false ) : void { if ( $ inMemory ) { ++ $ this -> stats [ 'memory' ] ; } else { ++ $ this -> stats [ 'hit' ] ; } if ( ! $ this -> logCalls ) { return ; } $ trace = \ debug_backtrace ( DEBUG_BACKTRACE_IGNORE_ARGS , 8 + $ tr... | Log a Cache hit gets info it needs by backtrace if needed . |
39,419 | private function getSimpleCallTrace ( array $ backtrace ) : array { $ calls = [ ] ; $ exitOnNext = false ; foreach ( $ backtrace as $ call ) { if ( ! isset ( $ call [ 'class' ] [ 2 ] ) || ( $ call [ 'class' ] [ 2 ] !== '\\' && \ strpos ( $ call [ 'class' ] , '\\' ) === false ) ) { continue ; } $ calls [ ] = $ call [ 'c... | Simplify trace to an array of strings . |
39,420 | public function logUnCachedHandler ( string $ handler ) : void { if ( ! isset ( $ this -> unCachedHandlers [ $ handler ] ) ) { $ this -> unCachedHandlers [ $ handler ] = 0 ; } ++ $ this -> unCachedHandlers [ $ handler ] ; } | Log un - cached handler being loaded . |
39,421 | public function createUrlWildcard ( $ sourceUrl , $ destinationUrl , $ forward ) { $ urlWildcard = new UrlWildcard ( ) ; $ urlWildcard -> destinationUrl = $ this -> cleanUrl ( $ destinationUrl ) ; $ urlWildcard -> sourceUrl = $ this -> cleanUrl ( $ sourceUrl ) ; $ urlWildcard -> forward = $ forward ; return $ urlWildca... | Creates a UrlWildcard object from given parameters . |
39,422 | protected function getUrlAlias ( $ pathinfo ) { $ pathPrefix = $ this -> generator -> getPathPrefixByRootLocationId ( $ this -> rootLocationId ) ; if ( $ this -> rootLocationId === null || $ this -> generator -> isUriPrefixExcluded ( $ pathinfo ) || $ pathPrefix === '/' ) { return parent :: getUrlAlias ( $ pathinfo ) ;... | Will return the right UrlAlias in regards to configured root location . |
39,423 | private function handleDefaultSettingsLoading ( ContainerBuilder $ container , FileLoader $ loader ) { $ loader -> load ( 'default_settings.yml' ) ; if ( ! $ this -> isRichTextBundleEnabled ( $ container ) ) { $ loader -> load ( 'ezrichtext_default_settings.yml' ) ; } foreach ( $ this -> defaultSettingsCollection as $ ... | Handle default settings . |
39,424 | private function handleRouting ( array $ config , ContainerBuilder $ container , FileLoader $ loader ) { $ loader -> load ( 'routing.yml' ) ; $ container -> setAlias ( 'router' , 'ezpublish.chain_router' ) ; if ( isset ( $ config [ 'router' ] [ 'default_router' ] [ 'non_siteaccess_aware_routes' ] ) ) { $ container -> s... | Handle routing parameters . |
39,425 | private function handleApiLoading ( ContainerBuilder $ container , FileLoader $ loader ) { $ coreLoader = new Loader \ YamlFileLoader ( $ container , new FileLocator ( __DIR__ . '/../../../Publish/Core/settings' ) ) ; $ coreLoader -> load ( 'repository.yml' ) ; $ coreLoader -> load ( 'repository/inner.yml' ) ; $ coreLo... | Handle public API loading . |
39,426 | private function handleCache ( array $ config , ContainerBuilder $ container , FileLoader $ loader ) { $ loader -> load ( 'cache.yml' ) ; $ purgeService = null ; if ( isset ( $ config [ 'http_cache' ] [ 'purge_type' ] ) ) { $ container -> setParameter ( 'ezpublish.http_cache.purge_type' , $ config [ 'http_cache' ] [ 'p... | Handle cache parameters . |
39,427 | private function handleLocale ( array $ config , ContainerBuilder $ container , FileLoader $ loader ) { $ loader -> load ( 'locale.yml' ) ; $ container -> setParameter ( 'ezpublish.locale.conversion_map' , $ config [ 'locale_conversion' ] + $ container -> getParameter ( 'ezpublish.locale.conversion_map' ) ) ; } | Handle locale parameters . |
39,428 | private function handleSiteAccessesRelation ( ContainerBuilder $ container ) { $ configResolver = $ container -> get ( 'ezpublish.config.resolver.core' ) ; $ configResolver -> setContainer ( $ container ) ; $ saRelationMap = array ( ) ; $ saList = $ container -> getParameter ( 'ezpublish.siteaccess.list' ) ; foreach ( ... | Handles relation between SiteAccesses . Related SiteAccesses share the same repository and root location id . |
39,429 | protected function convertRelationType ( $ stringType ) { $ stringTypeList = explode ( ',' , strtoupper ( $ stringType ) ) ; $ relationType = 0 ; foreach ( $ stringTypeList as $ stringTypeValue ) { switch ( $ stringTypeValue ) { case 'COMMON' : $ relationType |= Values \ Content \ Relation :: COMMON ; break ; case 'EMB... | Converts the string representation of the relation type to its constant . |
39,430 | protected function formatLibXmlError ( LibXMLError $ error ) { return sprintf ( '%s in %d:%d: %s' , $ this -> errorTypes [ $ error -> level ] , $ error -> line , $ error -> column , trim ( $ error -> message ) ) ; } | Formats libxml error object as a string . |
39,431 | public function buildService ( $ serviceClass , ConfigResolverInterface $ resolver , PageGateway $ storageGateway , ContentService $ contentService ) { $ pageSettings = $ resolver -> getParameter ( 'ezpage' ) ; $ pageService = new $ serviceClass ( $ contentService , $ pageSettings [ 'layouts' ] , $ pageSettings [ 'bloc... | Builds the page service . |
39,432 | public function onKernelRequest ( GetResponseEvent $ event ) { $ isRestRequest = true ; if ( ! $ this -> hasRestPrefix ( $ event -> getRequest ( ) ) ) { $ isRestRequest = false ; } $ event -> getRequest ( ) -> attributes -> set ( 'is_rest_request' , $ isRestRequest ) ; } | If the request is a REST one sets the is_rest_request request attribute . |
39,433 | public function in ( $ column ) { $ args = func_get_args ( ) ; if ( count ( $ args ) < 2 ) { throw new QueryException ( 'Expected two or more parameters to in()' ) ; } if ( is_array ( $ args [ 1 ] ) ) { $ values = array_values ( $ args [ 1 ] ) ; } else { $ values = array_slice ( $ args , 1 ) ; } if ( count ( $ values )... | Returns the SQL to check if a value is one in a set of given values .. |
39,434 | public function updateObjectStateGroup ( Group $ objectStateGroup ) { $ query = $ this -> dbHandler -> createUpdateQuery ( ) ; $ query -> update ( $ this -> dbHandler -> quoteTable ( 'ezcobj_state_group' ) ) -> set ( $ this -> dbHandler -> quoteColumn ( 'default_language_id' ) , $ query -> bindValue ( $ this -> maskGen... | Updates the stored object state group with provided data . |
39,435 | public function getLastValidBlockItem ( Block $ block ) { $ query = $ this -> connection -> createQueryBuilder ( ) ; $ query -> select ( $ this -> connection -> quoteIdentifier ( 'p.object_id' ) , $ this -> connection -> quoteIdentifier ( 'p.node_id' ) , $ this -> connection -> quoteIdentifier ( 'p.priority' ) , $ this... | Return the block item having a highest visible date for given block . Return null if no block item is registered for block . |
39,436 | public function getName ( $ languageCode = null ) { if ( $ languageCode === null ) { $ languageCode = $ this -> initialLanguageCode ; } return $ this -> names [ $ languageCode ] ; } | Returns the name computed from the name schema in the given language . If no language is given the name in initial language of the version if present otherwise null . |
39,437 | public function getContentTypeGroups ( ) { $ contentTypeGroups = array ( ) ; foreach ( $ this -> contentTypeGroupReferences as $ reference ) { $ contentTypeGroups [ ] = $ this -> contentTypeService -> loadContentTypeGroup ( $ reference ) ; } return $ contentTypeGroups ; } | Fetches and returns the ContentTypeGroups contained in the list . |
39,438 | protected function getRequestHeaders ( array $ headers ) { $ requestHeaders = '' ; foreach ( $ this -> headers as $ name => $ value ) { if ( ! isset ( $ headers [ $ name ] ) ) { $ requestHeaders .= "$name: $value\r\n" ; } } foreach ( $ headers as $ name => $ value ) { if ( is_numeric ( $ name ) ) { throw new RuntimeExc... | Get formatted request headers . |
39,439 | public function mapContent ( Content $ content ) { return new FullTextData ( [ 'id' => $ content -> versionInfo -> contentInfo -> id , 'contentTypeId' => $ content -> versionInfo -> contentInfo -> contentTypeId , 'sectionId' => $ content -> versionInfo -> contentInfo -> sectionId , 'published' => $ content -> versionIn... | Map given Content to a FullTextValue . |
39,440 | private function getFullTextFieldValue ( Content \ Field $ field , Type \ FieldDefinition $ fieldDefinition ) { $ fieldType = $ this -> fieldRegistry -> getType ( $ field -> type ) ; $ indexFields = $ fieldType -> getIndexData ( $ field , $ fieldDefinition ) ; $ fullTextFieldValue = '' ; foreach ( $ indexFields as $ fi... | Get FullTextField value . |
39,441 | public function vote ( TokenInterface $ token , $ object , array $ attributes ) { foreach ( $ attributes as $ attribute ) { if ( $ this -> supportsAttribute ( $ attribute ) ) { $ targets = isset ( $ attribute -> limitations [ 'targets' ] ) ? $ attribute -> limitations [ 'targets' ] : null ; if ( $ this -> repository ->... | Returns the vote for the given parameters . Checks if user has access to a given action on a given value object . |
39,442 | public function listRoles ( Request $ request ) { $ roles = array ( ) ; if ( $ request -> query -> has ( 'identifier' ) ) { try { $ role = $ this -> roleService -> loadRoleByIdentifier ( $ request -> query -> get ( 'identifier' ) ) ; $ roles [ ] = $ role ; } catch ( APINotFoundException $ e ) { } } else { $ offset = $ ... | Loads list of roles . |
39,443 | public function loadRoleDraft ( $ roleId ) { try { return $ this -> roleService -> loadRoleDraftByRoleId ( $ roleId ) ; } catch ( NotFoundException $ e ) { return $ this -> roleService -> loadRoleDraft ( $ roleId ) ; } } | Loads a role draft . |
39,444 | public function updateRole ( $ roleId , Request $ request ) { $ createStruct = $ this -> inputDispatcher -> parse ( new Message ( array ( 'Content-Type' => $ request -> headers -> get ( 'Content-Type' ) ) , $ request -> getContent ( ) ) ) ; return $ this -> roleService -> updateRole ( $ this -> roleService -> loadRole ... | Updates a role . |
39,445 | public function updateRoleDraft ( $ roleId , Request $ request ) { $ createStruct = $ this -> inputDispatcher -> parse ( new Message ( array ( 'Content-Type' => $ request -> headers -> get ( 'Content-Type' ) ) , $ request -> getContent ( ) ) ) ; try { $ roleDraft = $ this -> roleService -> loadRoleDraftByRoleId ( $ rol... | Updates a role draft . |
39,446 | public function publishRoleDraft ( $ roleId ) { try { $ roleDraft = $ this -> roleService -> loadRoleDraftByRoleId ( $ roleId ) ; } catch ( NotFoundException $ e ) { $ roleDraft = $ this -> roleService -> loadRoleDraft ( $ roleId ) ; } $ this -> roleService -> publishRoleDraft ( $ roleDraft ) ; $ role = $ this -> roleS... | Publishes a role draft . |
39,447 | public function deleteRole ( $ roleId ) { $ this -> roleService -> deleteRole ( $ this -> roleService -> loadRole ( $ roleId ) ) ; return new Values \ NoContent ( ) ; } | Delete a role by ID . |
39,448 | public function deleteRoleDraft ( $ roleId ) { $ this -> roleService -> deleteRoleDraft ( $ this -> roleService -> loadRoleDraft ( $ roleId ) ) ; return new Values \ NoContent ( ) ; } | Delete a role draft by ID . |
39,449 | public function loadPolicies ( $ roleId , Request $ request ) { $ loadedRole = $ this -> roleService -> loadRole ( $ roleId ) ; return new Values \ PolicyList ( $ loadedRole -> getPolicies ( ) , $ request -> getPathInfo ( ) ) ; } | Loads the policies for the role . |
39,450 | public function deletePolicies ( $ roleId ) { $ loadedRole = $ this -> roleService -> loadRole ( $ roleId ) ; foreach ( $ loadedRole -> getPolicies ( ) as $ policy ) { $ this -> roleService -> deletePolicy ( $ policy ) ; } return new Values \ NoContent ( ) ; } | Deletes all policies from a role . |
39,451 | public function loadPolicy ( $ roleId , $ policyId , Request $ request ) { $ loadedRole = $ this -> roleService -> loadRole ( $ roleId ) ; foreach ( $ loadedRole -> getPolicies ( ) as $ policy ) { if ( $ policy -> id == $ policyId ) { return $ policy ; } } throw new Exceptions \ NotFoundException ( "Policy not found: '... | Loads a policy . |
39,452 | public function addPolicy ( $ roleId , Request $ request ) { $ createStruct = $ this -> inputDispatcher -> parse ( new Message ( array ( 'Content-Type' => $ request -> headers -> get ( 'Content-Type' ) ) , $ request -> getContent ( ) ) ) ; try { $ role = $ this -> roleService -> addPolicyByRoleDraft ( $ this -> roleSer... | Adds a policy to role . |
39,453 | public function deletePolicy ( $ roleId , $ policyId , Request $ request ) { try { $ roleDraft = $ this -> roleService -> loadRoleDraft ( $ roleId ) ; $ policy = null ; foreach ( $ roleDraft -> getPolicies ( ) as $ rolePolicy ) { if ( $ rolePolicy -> id == $ policyId ) { $ policy = $ rolePolicy ; break ; } } if ( $ pol... | Delete a policy from role . |
39,454 | public function removePolicyByRoleDraft ( $ roleId , $ policyId , Request $ request ) { $ roleDraft = $ this -> roleService -> loadRoleDraft ( $ roleId ) ; $ policy = null ; foreach ( $ roleDraft -> getPolicies ( ) as $ rolePolicy ) { if ( $ rolePolicy -> id == $ policyId ) { $ policy = $ rolePolicy ; break ; } } if ( ... | Remove a policy from a role draft . |
39,455 | public function assignRoleToUserGroup ( $ groupPath , Request $ request ) { $ roleAssignment = $ this -> inputDispatcher -> parse ( new Message ( array ( 'Content-Type' => $ request -> headers -> get ( 'Content-Type' ) ) , $ request -> getContent ( ) ) ) ; $ groupLocationParts = explode ( '/' , $ groupPath ) ; $ groupL... | Assigns role to user group . |
39,456 | public function unassignRoleFromUser ( $ userId , $ roleId ) { $ user = $ this -> userService -> loadUser ( $ userId ) ; $ role = $ this -> roleService -> loadRole ( $ roleId ) ; $ this -> roleService -> unassignRoleFromUser ( $ role , $ user ) ; $ roleAssignments = $ this -> roleService -> getRoleAssignmentsForUser ( ... | Un - assigns role from user . |
39,457 | public function unassignRoleFromUserGroup ( $ groupPath , $ roleId ) { $ groupLocationParts = explode ( '/' , $ groupPath ) ; $ groupLocation = $ this -> locationService -> loadLocation ( array_pop ( $ groupLocationParts ) ) ; $ userGroup = $ this -> userService -> loadUserGroup ( $ groupLocation -> contentId ) ; $ rol... | Un - assigns role from user group . |
39,458 | public function loadRoleAssignmentsForUser ( $ userId ) { $ user = $ this -> userService -> loadUser ( $ userId ) ; $ roleAssignments = $ this -> roleService -> getRoleAssignmentsForUser ( $ user ) ; return new Values \ RoleAssignmentList ( $ roleAssignments , $ user -> id ) ; } | Loads role assignments for user . |
39,459 | public function loadRoleAssignmentsForUserGroup ( $ groupPath ) { $ groupLocationParts = explode ( '/' , $ groupPath ) ; $ groupLocation = $ this -> locationService -> loadLocation ( array_pop ( $ groupLocationParts ) ) ; $ userGroup = $ this -> userService -> loadUserGroup ( $ groupLocation -> contentId ) ; $ roleAssi... | Loads role assignments for user group . |
39,460 | public function loadRoleAssignmentForUser ( $ userId , $ roleId , Request $ request ) { $ user = $ this -> userService -> loadUser ( $ userId ) ; $ roleAssignments = $ this -> roleService -> getRoleAssignmentsForUser ( $ user ) ; foreach ( $ roleAssignments as $ roleAssignment ) { if ( $ roleAssignment -> getRole ( ) -... | Returns a role assignment to the given user . |
39,461 | public function loadRoleAssignmentForUserGroup ( $ groupPath , $ roleId , Request $ request ) { $ groupLocationParts = explode ( '/' , $ groupPath ) ; $ groupLocation = $ this -> locationService -> loadLocation ( array_pop ( $ groupLocationParts ) ) ; $ userGroup = $ this -> userService -> loadUserGroup ( $ groupLocati... | Returns a role assignment to the given user group . |
39,462 | public function listPoliciesForUser ( Request $ request ) { return new Values \ PolicyList ( $ this -> roleService -> loadPoliciesByUserId ( $ request -> query -> get ( 'userId' ) ) , $ request -> getPathInfo ( ) ) ; } | Search all policies which are applied to a given user . |
39,463 | protected function updateFieldData ( VersionInfo $ versionInfo , Field $ field ) { $ connection = $ this -> getConnection ( ) ; $ updateQuery = $ connection -> createUpdateQuery ( ) ; $ updateQuery -> update ( $ connection -> quoteTable ( 'ezgmaplocation' ) ) -> set ( $ connection -> quoteColumn ( 'latitude' ) , $ upda... | Performs an update on the field data . |
39,464 | protected function storeNewFieldData ( VersionInfo $ versionInfo , Field $ field ) { $ connection = $ this -> getConnection ( ) ; $ insertQuery = $ connection -> createInsertQuery ( ) ; $ insertQuery -> insertInto ( $ connection -> quoteTable ( 'ezgmaplocation' ) ) -> set ( $ connection -> quoteColumn ( 'latitude' ) , ... | Stores new field data . |
39,465 | public function applyDefaultSettings ( & $ fieldSettings ) { if ( $ fieldSettings !== null && ! is_array ( $ fieldSettings ) ) { throw new InvalidArgumentType ( '$fieldSettings' , 'array|null' , $ fieldSettings ) ; } foreach ( $ this -> getSettingsSchema ( ) as $ settingName => $ settingConfiguration ) { if ( ! array_k... | Applies the default values to the fieldSettings of a FieldDefinitionCreateStruct . |
39,466 | private function createStreamListener ( ) { $ callback = function ( $ event , $ status , $ events , $ stream ) { if ( ! isset ( $ this -> streamEvents [ ( int ) $ stream ] ) ) { return ; } if ( ( $ events | 4 ) === 4 ) { return ; } if ( isset ( $ this -> readStreams [ ( int ) $ stream ] ) && ( $ events & \ UV :: READAB... | Create a stream listener |
39,467 | public static function create ( ) { if ( \ function_exists ( 'uv_loop_new' ) ) { return new ExtUvLoop ( ) ; } elseif ( \ class_exists ( 'libev\EventLoop' , false ) ) { return new ExtLibevLoop ( ) ; } elseif ( \ class_exists ( 'EvLoop' , false ) ) { return new ExtEvLoop ( ) ; } elseif ( \ class_exists ( 'EventBase' , fa... | Creates a new event loop instance |
39,468 | protected function validate ( PropertyMetadata $ metadata , string $ name , & $ value ) { if ( ! $ metadata -> isValid ( $ value ) ) { $ class = get_class ( $ this ) ; throw new InvalidArgumentException ( "Value for {$class}::\${$name} property is invalid." ) ; } } | Validates the value . |
39,469 | public static function getRelationships ( IEntity $ entity ) : array { $ return = [ [ ] , [ ] , [ ] ] ; foreach ( $ entity -> getMetadata ( ) -> getProperties ( ) as $ propertyMeta ) { if ( $ propertyMeta -> relationship === null ) { continue ; } $ name = $ propertyMeta -> name ; if ( ! $ propertyMeta -> relationship -... | Returns entity relationships as array 0 = > pre 1 = > post 2 = > nulls |
39,470 | public static function getConfiguration ( array $ repositories ) { $ config = [ [ ] , [ ] , [ ] ] ; foreach ( $ repositories as $ name => $ repository ) { $ className = is_object ( $ repository ) ? get_class ( $ repository ) : $ repository ; $ config [ 0 ] [ $ className ] = true ; $ config [ 1 ] [ $ name ] = $ classNam... | Creates repository list configuration . |
39,471 | public function getRawValue ( ) : array { $ primaryValues = [ ] ; foreach ( $ this -> getIterator ( ) as $ entity ) { if ( $ entity -> isPersisted ( ) ) { $ primaryValues [ ] = $ entity -> getValue ( 'id' ) ; } } return $ primaryValues ; } | Returns primary values of enitities in relationship . |
39,472 | public static function toArray ( IEntity $ entity , int $ type = self :: RELATIONSHIP_AS_IS , int $ recursionLevel = 0 ) : array { $ return = [ ] ; $ metadata = $ entity -> getMetadata ( ) ; foreach ( $ metadata -> getProperties ( ) as $ name => $ metadataProperty ) { if ( ! $ entity -> hasValue ( $ name ) ) { $ value ... | Converts IEntity to an array . |
39,473 | public function toCollection ( $ data ) : ICollection { if ( $ data instanceof QueryBuilder ) { return new DbalCollection ( $ this , $ this -> connection , $ data ) ; } elseif ( is_array ( $ data ) ) { $ storageReflection = $ this -> getStorageReflection ( ) ; $ result = array_map ( [ $ this -> getRepository ( ) , 'hyd... | Transforms value from mapper which is not a collection . |
39,474 | public function addMapping ( string $ entity , string $ storage , callable $ toEntityCb = null , callable $ toStorageCb = null ) : StorageReflection { if ( isset ( $ this -> mappings [ self :: TO_ENTITY ] [ $ storage ] ) ) { throw new InvalidStateException ( "Mapping for $storage column is already defined." ) ; } elsei... | Adds mapping . |
39,475 | public function setMapping ( string $ entity , string $ storage , callable $ toEntityCb = null , callable $ toStorageCb = null ) : StorageReflection { unset ( $ this -> mappings [ self :: TO_ENTITY ] [ $ storage ] , $ this -> mappings [ self :: TO_STORAGE ] [ $ entity ] ) ; return $ this -> addMapping ( $ entity , $ st... | Sets mapping . |
39,476 | public function addModifier ( string $ storageKey , string $ saveModifier ) : StorageReflection { $ this -> modifiers [ $ storageKey ] = $ saveModifier ; return $ this ; } | Adds parameter modifier for data - trasform to Nextras Dbal layer . |
39,477 | public function getValue ( IEntity $ entity , string $ expr ) : ? ValueReference { [ $ tokens , $ sourceEntityClassName ] = ConditionParserHelper :: parsePropertyExpr ( $ expr ) ; $ sourceEntityMeta = $ this -> repository -> getEntityMetadata ( $ sourceEntityClassName ) ; return $ this -> getValueByTokens ( $ entity , ... | Returns value reference returns null when entity should not be evaluated at all because of STI condition . |
39,478 | public function endPage ( $ ajaxMode = false ) { $ this -> trigger ( PageEvent :: END ) ; $ content = ob_get_clean ( ) ; echo strtr ( $ content , [ self :: PH_HEAD => $ this -> renderHeadHtml ( ) , self :: PH_BODY_BEGIN => $ this -> renderBodyBeginHtml ( ) , self :: PH_BODY_END => $ this -> renderBodyEndHtml ( $ ajaxMo... | Marks the ending of an HTML page . |
39,479 | public function extractHeaders ( ) { $ headers = [ ] ; foreach ( array_keys ( $ this -> cors ) as $ headerField ) { $ headerData = $ this -> request -> getHeaderLine ( $ headerField ) ; if ( $ headerData !== null ) { $ headers [ $ headerField ] = $ headerData ; } } return $ headers ; } | Extract CORS headers from the request . |
39,480 | protected function validateCache ( $ lastModified , $ etag ) { $ request = Yii :: getApp ( ) -> getRequest ( ) ; if ( $ request -> hasHeader ( 'if-none-match' ) ) { return $ etag !== null && in_array ( $ etag , Yii :: getApp ( ) -> request -> getETags ( ) , true ) ; } elseif ( $ request -> hasHeader ( 'if-modified-sinc... | Validates if the HTTP cache contains valid content . If both Last - Modified and ETag are null returns false . |
39,481 | protected function sendCacheControlHeader ( ) { if ( $ this -> sessionCacheLimiter !== null ) { if ( $ this -> sessionCacheLimiter === '' && ! headers_sent ( ) && Yii :: getApp ( ) -> getSession ( ) -> getIsActive ( ) ) { header_remove ( 'Expires' ) ; header_remove ( 'Cache-Control' ) ; header_remove ( 'Last-Modified' ... | Sends the cache control header to the client . |
39,482 | public function checkRateLimit ( $ user , $ request , $ response , $ action ) { [ $ limit , $ window ] = $ user -> getRateLimit ( $ request , $ action ) ; [ $ allowance , $ timestamp ] = $ user -> loadAllowance ( $ request , $ action ) ; $ current = time ( ) ; $ allowance += ( int ) ( ( $ current - $ timestamp ) * $ li... | Checks whether the rate limit exceeds . |
39,483 | public function addRateLimitHeaders ( $ response , $ limit , $ remaining , $ reset ) { if ( $ this -> enableRateLimitHeaders ) { $ response -> setHeader ( 'X-Rate-Limit-Limit' , $ limit ) ; $ response -> setHeader ( 'X-Rate-Limit-Remaining' , $ remaining ) ; $ response -> setHeader ( 'X-Rate-Limit-Reset' , $ reset ) ; ... | Adds the rate limit headers to the response . |
39,484 | public function clear ( ) { $ this -> _headerCollection = null ; $ this -> _cookies = null ; $ this -> _statusCode = 200 ; $ this -> reasonPhrase = 'OK' ; $ this -> data = null ; $ this -> bodyRange = null ; $ this -> isSent = false ; $ this -> setBody ( null ) ; } | Clears the headers cookies content status code of the response . |
39,485 | protected function sendHeaders ( ) { if ( headers_sent ( $ file , $ line ) ) { throw new HeadersAlreadySentException ( $ file , $ line ) ; } if ( $ this -> _headerCollection ) { foreach ( $ this -> getHeaders ( ) as $ name => $ values ) { $ name = str_replace ( ' ' , '-' , ucwords ( str_replace ( '-' , ' ' , $ name ) )... | Sends the response headers to the client . |
39,486 | protected function sendCookies ( ) { if ( $ this -> _cookies === null ) { return ; } $ request = $ this -> app -> getRequest ( ) ; if ( $ request -> enableCookieValidation ) { if ( $ request -> cookieValidationKey == '' ) { throw new InvalidConfigException ( get_class ( $ request ) . '::cookieValidationKey must be conf... | Sends the cookies to the client . |
39,487 | protected function sendContent ( ) { $ body = $ this -> getBody ( ) ; if ( ! $ body -> isReadable ( ) ) { throw new \ RuntimeException ( 'Unable to send content: body stream is not readable.' ) ; } set_time_limit ( 0 ) ; $ chunkSize = 8 * 1024 * 1024 ; if ( is_array ( $ this -> bodyRange ) ) { [ $ begin , $ end ] = $ t... | Sends the response content to the client . |
39,488 | public function sendContentAsFile ( $ content , $ attachmentName , $ options = [ ] ) { $ contentLength = StringHelper :: byteLength ( $ content ) ; $ range = $ this -> getHttpRange ( $ contentLength ) ; if ( $ range === false ) { $ this -> setHeader ( 'Content-Range' , "bytes */$contentLength" ) ; throw new RangeNotSat... | Sends the specified content as a file to the browser . |
39,489 | public function sendStreamAsFile ( $ handle , $ attachmentName , $ options = [ ] ) { if ( isset ( $ options [ 'fileSize' ] ) ) { $ fileSize = $ options [ 'fileSize' ] ; } else { fseek ( $ handle , 0 , SEEK_END ) ; $ fileSize = ftell ( $ handle ) ; } $ range = $ this -> getHttpRange ( $ fileSize ) ; if ( $ range === fal... | Sends the specified stream as a file to the browser . |
39,490 | public function setDownloadHeaders ( $ attachmentName , $ mimeType = null , $ inline = false , $ contentLength = null ) { $ disposition = $ inline ? 'inline' : 'attachment' ; $ headers = [ 'Pragma' => 'public' , 'Accept-Ranges' => 'bytes' , 'Expires' => '0' , 'Cache-Control' => 'must-revalidate, post-check=0, pre-check... | Sets a default set of HTTP headers for file downloading purpose . |
39,491 | protected function getHttpRange ( $ fileSize ) { $ rangeHeader = $ this -> app -> getRequest ( ) -> getHeaderLine ( 'Range' ) ; if ( empty ( $ rangeHeader ) || $ rangeHeader === '-' ) { return [ 0 , $ fileSize - 1 ] ; } if ( ! preg_match ( '/^bytes=(\d*)-(\d*)$/' , $ rangeHeader , $ matches ) ) { return false ; } if ( ... | Determines the HTTP range given in the request . |
39,492 | protected function getDispositionHeaderValue ( $ disposition , $ attachmentName ) { $ fallbackName = str_replace ( [ '%' , '/' , '\\' , '"' ] , [ '_' , '_' , '_' , '\\"' ] , InflectorHelper :: transliterate ( $ attachmentName , InflectorHelper :: TRANSLITERATE_LOOSE ) ) ; $ utfName = rawurlencode ( str_replace ( [ '%' ... | Returns Content - Disposition header value that is safe to use with both old and new browsers . |
39,493 | public function redirect ( $ url , $ statusCode = 302 , $ checkAjax = true ) { if ( is_array ( $ url ) && isset ( $ url [ 0 ] ) ) { $ url [ 0 ] = '/' . ltrim ( $ url [ 0 ] , '/' ) ; } $ url = Url :: to ( $ url ) ; if ( strncmp ( $ url , '/' , 1 ) === 0 && strncmp ( $ url , '//' , 2 ) !== 0 ) { $ url = $ this -> app -> ... | Redirects the browser to the specified URL . |
39,494 | public function goBack ( $ defaultUrl = null ) { return $ this -> app -> getResponse ( ) -> redirect ( $ this -> app -> getUser ( ) -> getReturnUrl ( $ defaultUrl ) ) ; } | Redirects the browser to the last visited page . |
39,495 | protected function loginByCookie ( ) { $ data = $ this -> getIdentityAndDurationFromCookie ( ) ; if ( isset ( $ data [ 'identity' ] , $ data [ 'duration' ] ) ) { $ identity = $ data [ 'identity' ] ; $ duration = $ data [ 'duration' ] ; if ( $ this -> beforeLogin ( $ identity , true , $ duration ) ) { $ this -> switchId... | Logs in a user by cookie . |
39,496 | protected function renewIdentityCookie ( ) { $ name = $ this -> identityCookie [ 'name' ] ; $ value = $ this -> app -> getRequest ( ) -> getCookies ( ) -> getValue ( $ name ) ; if ( $ value !== null ) { $ data = json_decode ( $ value , true ) ; if ( is_array ( $ data ) && isset ( $ data [ 2 ] ) ) { $ cookie = Yii :: cr... | Renews the identity cookie . This method will set the expiration time of the identity cookie to be the current time plus the originally specified cookie duration . |
39,497 | protected function denyAccess ( $ action ) { $ exception = new NotFoundHttpException ( Yii :: t ( 'yii' , 'Page not found.' ) ) ; if ( ! empty ( Yii :: getApp ( ) -> getRequest ( ) -> hostName ) ) { throw $ exception ; } $ response = Yii :: getApp ( ) -> getResponse ( ) ; $ errorHandler = Yii :: getApp ( ) -> getErrorH... | Denies the access . The default implementation will display 404 page right away terminating the program execution . You may override this method creating your own deny access handler . While doing so make sure you avoid usage of the current requested host name creation of absolute URL links caching page parts and so on... |
39,498 | public function getExceptionName ( $ exception ) { if ( $ exception instanceof \ yii \ exceptions \ Exception || $ exception instanceof \ yii \ exceptions \ InvalidCallException || $ exception instanceof \ yii \ exceptions \ InvalidArgumentException || $ exception instanceof \ yii \ exceptions \ UnknownMethodException ... | Returns human - readable exception name . |
39,499 | public function writeSession ( $ id , $ data ) { try { $ fields = $ this -> composeFields ( $ id , $ data ) ; $ fields = $ this -> typecastFields ( $ fields ) ; $ this -> db -> createCommand ( ) -> upsert ( $ this -> sessionTable , $ fields ) -> execute ( ) ; } catch ( \ Exception $ e ) { Yii :: getApp ( ) -> errorHand... | Session write handler . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.