idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
58,700
public function getPathCommand ( string $ package , string $ controller = 'Standard' , string $ action = 'index' , string $ format = 'html' ) { $ packageParts = explode ( '\\' , $ package , 2 ) ; $ package = $ packageParts [ 0 ] ; $ subpackage = isset ( $ packageParts [ 1 ] ) ? $ packageParts [ 1 ] : null ; $ routeValu...
Generate a route path
58,701
public function routePathCommand ( string $ path , string $ method = 'GET' ) { $ server = [ 'REQUEST_URI' => $ path , 'REQUEST_METHOD' => $ method ] ; $ httpRequest = new Request ( [ ] , [ ] , [ ] , $ server ) ; $ routeContext = new RouteContext ( $ httpRequest , RouteParameters :: createEmpty ( ) ) ; foreach ( $ this ...
Route the given route path
58,702
protected function getControllerObjectName ( string $ packageKey , string $ subPackageKey , string $ controllerName ) : string { $ possibleObjectName = '@package\@subpackage\Controller\@controllerController' ; $ possibleObjectName = str_replace ( '@package' , str_replace ( '.' , '\\' , $ packageKey ) , $ possibleObject...
Returns the object name of the controller defined by the package subpackage key and controller name
58,703
public static function cidrMatch ( $ ip , $ range ) { if ( strpos ( $ range , '/' ) === false ) { $ bits = null ; $ subnet = $ range ; } else { list ( $ subnet , $ bits ) = explode ( '/' , $ range ) ; } $ ip = inet_pton ( $ ip ) ; $ subnet = inet_pton ( $ subnet ) ; if ( $ ip === false || $ subnet === false ) { return ...
Matches a CIDR range pattern against an IP
58,704
public function generateKey ( $ name ) { if ( strlen ( $ name ) === 0 ) { throw new SecurityException ( 'Required name argument was empty' , 1334215474 ) ; } $ password = UtilityAlgorithms :: generateRandomString ( $ this -> passwordGenerationLength ) ; $ this -> persistKey ( $ name , $ password ) ; return $ password ;...
Generates a new key & saves it encrypted with a hashing strategy
58,705
public function storeKey ( $ name , $ password ) { if ( strlen ( $ name ) === 0 ) { throw new SecurityException ( 'Required name argument was empty' , 1334215443 ) ; } if ( strlen ( $ password ) === 0 ) { throw new SecurityException ( 'Required password argument was empty' , 1334215349 ) ; } $ this -> persistKey ( $ na...
Saves a key encrypted with a hashing strategy
58,706
public function getKey ( $ name ) { if ( strlen ( $ name ) === 0 ) { throw new SecurityException ( 'Required name argument was empty' , 1334215378 ) ; } $ keyPathAndFilename = $ this -> getKeyPathAndFilename ( $ name ) ; if ( ! file_exists ( $ keyPathAndFilename ) ) { throw new SecurityException ( sprintf ( 'The key "%...
Returns a key by its name
58,707
protected function persistKey ( $ name , $ password ) { $ hashedPassword = $ this -> hashService -> hashPassword ( $ password , $ this -> passwordHashingStrategy ) ; $ keyPathAndFilename = $ this -> getKeyPathAndFilename ( $ name ) ; if ( ! is_dir ( $ this -> getPath ( ) ) ) { Utility \ Files :: createDirectoryRecursiv...
Persists a key to the file system
58,708
protected function getKeyPathAndFilename ( $ name ) { return Utility \ Files :: concatenatePaths ( [ $ this -> getPath ( ) , $ this -> checkKeyName ( $ name ) ] ) ; }
Returns the path and filename for the key with the given name .
58,709
public function build ( ) { $ this -> objectConfigurations = $ this -> objectManager -> getObjectConfigurations ( ) ; foreach ( $ this -> objectConfigurations as $ objectName => $ objectConfiguration ) { $ className = $ objectConfiguration -> getClassName ( ) ; if ( $ className === '' || $ this -> compiler -> hasCacheE...
Analyzes the Object Configuration provided by the compiler and builds the necessary PHP code for the proxy classes to realize dependency injection .
58,710
protected function buildSetInstanceCode ( Configuration $ objectConfiguration ) { if ( $ objectConfiguration -> getScope ( ) === Configuration :: SCOPE_PROTOTYPE ) { return '' ; } $ code = ' if (get_class($this) === \'' . $ objectConfiguration -> getClassName ( ) . '\') \Neos\Flow\Core\Bootstrap::$staticObjectMa...
Renders additional code which registers the instance of the proxy class at the Object Manager before constructor injection is executed . Used in constructors and wakeup methods .
58,711
protected function buildPropertyInjectionCode ( Configuration $ objectConfiguration ) { $ commands = [ ] ; $ injectedProperties = [ ] ; foreach ( $ objectConfiguration -> getProperties ( ) as $ propertyName => $ propertyConfiguration ) { if ( $ propertyConfiguration -> getAutowiring ( ) === Configuration :: AUTOWIRING_...
Builds the code necessary to inject setter based dependencies .
58,712
protected function buildPropertyInjectionCodeByConfiguration ( Configuration $ objectConfiguration , $ propertyName , Configuration $ propertyConfiguration ) { $ className = $ objectConfiguration -> getClassName ( ) ; $ propertyObjectName = $ propertyConfiguration -> getObjectName ( ) ; $ propertyClassName = $ property...
Builds code which injects an object which was specified by its object configuration
58,713
public function buildPropertyInjectionCodeByString ( Configuration $ objectConfiguration , ConfigurationProperty $ propertyConfiguration , $ propertyName , $ propertyObjectName ) { $ className = $ objectConfiguration -> getClassName ( ) ; if ( strpos ( $ propertyObjectName , '.' ) !== false ) { $ settingPath = explode ...
Builds code which injects an object which was specified by its object name
58,714
public function buildPropertyInjectionCodeByConfigurationTypeAndPath ( Configuration $ objectConfiguration , $ propertyName , $ configurationType , $ configurationPath = null ) { $ className = $ objectConfiguration -> getClassName ( ) ; if ( $ configurationPath !== null ) { $ preparedSetterArgument = '\Neos\Flow\Core\B...
Builds code which assigns the value stored in the specified configuration into the given class property .
58,715
protected function buildLazyPropertyInjectionCode ( $ propertyObjectName , $ propertyClassName , $ propertyName , $ preparedSetterArgument ) { $ setterArgumentHash = "'" . md5 ( $ preparedSetterArgument ) . "'" ; $ commands [ ] = ' $this->Flow_Proxy_LazyPropertyInjection(\'' . $ propertyObjectName . '\', \'' . $ pro...
Builds code which injects a DependencyProxy instead of the actual dependency
58,716
protected function buildLifecycleInitializationCode ( Configuration $ objectConfiguration , $ cause ) { $ lifecycleInitializationMethodName = $ objectConfiguration -> getLifecycleInitializationMethodName ( ) ; if ( ! $ this -> reflectionService -> hasMethod ( $ objectConfiguration -> getClassName ( ) , $ lifecycleIniti...
Builds code which calls the lifecycle initialization method if any .
58,717
protected function buildLifecycleShutdownCode ( Configuration $ objectConfiguration , $ cause ) { $ lifecycleShutdownMethodName = $ objectConfiguration -> getLifecycleShutdownMethodName ( ) ; if ( ! $ this -> reflectionService -> hasMethod ( $ objectConfiguration -> getClassName ( ) , $ lifecycleShutdownMethodName ) ) ...
Builds code which registers the lifecycle shutdown method if any .
58,718
protected function compileStaticMethods ( $ className , ProxyClass $ proxyClass ) { $ methodNames = $ this -> reflectionService -> getMethodsAnnotatedWith ( $ className , Flow \ CompileStatic :: class ) ; foreach ( $ methodNames as $ methodName ) { if ( ! $ this -> reflectionService -> isMethodStatic ( $ className , $ ...
Compile the result of methods marked with CompileStatic into the proxy class
58,719
protected function getOptionValueScalar ( $ valueElement ) { if ( is_object ( $ valueElement ) ) { if ( $ this -> hasArgument ( 'optionValueField' ) ) { return ObjectAccess :: getPropertyPath ( $ valueElement , $ this -> arguments [ 'optionValueField' ] ) ; } elseif ( $ this -> persistenceManager -> getIdentifierByObje...
Get the option value for an object
58,720
protected function renderOptionTag ( $ value , $ label ) { $ output = '<option value="' . htmlspecialchars ( $ value ) . '"' ; if ( $ this -> isSelected ( $ value ) ) { $ output .= ' selected="selected"' ; } $ output .= '>' . htmlspecialchars ( $ label ) . '</option>' ; return $ output ; }
Render one option tag
58,721
public static function fromMethodName ( string $ methodName ) : array { if ( strpos ( $ methodName , '::' ) > 0 ) { list ( $ className , $ functionName ) = explode ( '::' , $ methodName ) ; } elseif ( substr ( $ methodName , - 9 , 9 ) === '{closure}' ) { $ className = substr ( $ methodName , 0 , - 9 ) ; $ functionName ...
Returns an array containing the log environment variables under the key FLOW_LOG_ENVIRONMENT to be set as part of the additional data in an log method call .
58,722
public function flush ( ) { Files :: emptyDirectoryRecursively ( $ this -> cacheDirectory ) ; if ( $ this -> frozen === true ) { @ unlink ( $ this -> cacheDirectory . 'FrozenCache.data' ) ; $ this -> frozen = false ; } }
Removes all cache entries of this cache and sets the frozen flag to false .
58,723
protected function isCacheFileExpired ( string $ cacheEntryPathAndFilename , bool $ acquireLock = true ) : bool { if ( is_file ( $ cacheEntryPathAndFilename ) === false ) { return true ; } $ expiryTimeOffset = filesize ( $ cacheEntryPathAndFilename ) - self :: DATASIZE_DIGITS - self :: EXPIRYTIME_LENGTH ; if ( $ acquir...
Checks if the given cache entry files are still valid or if their lifetime has exceeded .
58,724
protected function findCacheFilesByIdentifier ( string $ entryIdentifier ) { $ pattern = $ this -> cacheDirectory . $ entryIdentifier ; $ filesFound = glob ( $ pattern ) ; if ( $ filesFound === false || count ( $ filesFound ) === 0 ) { return false ; } return $ filesFound ; }
Tries to find the cache entry for the specified identifier . Usually only one cache entry should be found - if more than one exist this is due to some error or crash .
58,725
public function get ( string $ identifier ) : \ Psr \ Log \ LoggerInterface { if ( isset ( $ this -> instances [ $ identifier ] ) ) { return $ this -> instances [ $ identifier ] ; } if ( ! isset ( $ this -> configuration [ $ identifier ] ) ) { throw new \ InvalidArgumentException ( sprintf ( 'The given log identifier "...
Get the logger configured with given identifier . This implementation treats the logger as singleton .
58,726
protected function instantiateBackends ( array $ configuration ) { $ backends = [ ] ; foreach ( $ configuration as $ backendConfiguration ) { $ class = $ backendConfiguration [ 'class' ] ?? '' ; $ options = $ backendConfiguration [ 'options' ] ?? [ ] ; $ backends [ ] = $ this -> instantiateBackend ( $ class , $ options...
Instantiate all configured backends
58,727
protected function instantiateBackend ( string $ class , array $ options = [ ] ) { $ backend = new $ class ( $ options ) ; if ( ! ( $ backend instanceof BackendInterface ) ) { throw new \ Exception ( sprintf ( 'The log backend class "%s" does not implement the BackendInterface' , htmlspecialchars ( $ class ) ) , 151535...
Instantiate a backend based on configuration .
58,728
public function setRepositoryClassName ( $ repositoryClassName ) { if ( $ this -> modelType === self :: MODELTYPE_VALUEOBJECT && $ repositoryClassName !== null ) { throw new Exception \ ClassSchemaConstraintViolationException ( 'Value objects must not be aggregate roots (have a repository)' , 1268739172 ) ; } $ this ->...
Set the class name of the repository managing an entity .
58,729
public function isAuthenticated ( ) : bool { if ( ! $ this -> securityContext -> canBeInitialized ( ) ) { return false ; } return array_reduce ( $ this -> securityContext -> getAuthenticationTokens ( ) , function ( bool $ isAuthenticated , TokenInterface $ token ) { return $ isAuthenticated || $ token -> isAuthenticate...
Returns true if any account is currently authenticated
58,730
public function hasAccess ( string $ privilegeTarget , array $ parameters = [ ] ) : bool { if ( ! $ this -> securityContext -> canBeInitialized ( ) ) { return false ; } return $ this -> privilegeManager -> isPrivilegeTargetGranted ( $ privilegeTarget , $ parameters ) ; }
Returns true if access to the given privilege - target is granted
58,731
public function injectSettings ( array $ settings ) : void { if ( isset ( $ settings [ 'security' ] [ 'authentication' ] [ 'authenticationStrategy' ] ) ) { $ authenticationStrategyName = $ settings [ 'security' ] [ 'authentication' ] [ 'authenticationStrategy' ] ; switch ( $ authenticationStrategyName ) { case 'allToke...
Inject the settings and does a fresh build of tokens based on the injected settings
58,732
public function logout ( ) { if ( $ this -> isAuthenticated ( ) !== true ) { return ; } $ this -> isAuthenticated = null ; $ session = $ this -> sessionManager -> getCurrentSession ( ) ; foreach ( $ this -> securityContext -> getAuthenticationTokens ( ) as $ token ) { $ token -> setAuthenticationStatus ( TokenInterface...
Logout all active authentication tokens
58,733
public function convertFrom ( $ source , $ targetType , array $ convertedChildProperties = [ ] , PropertyMappingConfigurationInterface $ configuration = null ) { if ( empty ( $ source ) ) { return null ; } if ( $ source instanceof UploadedFileInterface ) { return $ this -> handleUploadedFile ( $ source , $ configuratio...
Converts the given string or array to a PersistentResource object .
58,734
public function findByAccountIdentifierAndAuthenticationProviderName ( $ accountIdentifier , $ authenticationProviderName ) { $ query = $ this -> createQuery ( ) ; return $ query -> matching ( $ query -> logicalAnd ( $ query -> equals ( 'accountIdentifier' , $ accountIdentifier ) , $ query -> equals ( 'authenticationPr...
Returns the account for a specific authentication provider with the given identifier
58,735
public function findActiveByAccountIdentifierAndAuthenticationProviderName ( $ accountIdentifier , $ authenticationProviderName ) { $ query = $ this -> createQuery ( ) ; return $ query -> matching ( $ query -> logicalAnd ( $ query -> equals ( 'accountIdentifier' , $ accountIdentifier ) , $ query -> equals ( 'authentica...
Returns the account for a specific authentication provider with the given identifier if it s not expired
58,736
public function dispatch ( RequestInterface $ request , ResponseInterface $ response ) { if ( $ request instanceof CliRequest ) { $ this -> initiateDispatchLoop ( $ request , $ response ) ; return ; } $ securityContext = $ this -> objectManager -> get ( Context :: class ) ; if ( $ securityContext -> areAuthorizationChe...
Dispatches a request to a controller
58,737
protected function initiateDispatchLoop ( RequestInterface $ request , ResponseInterface $ response ) { $ dispatchLoopCount = 0 ; while ( ! $ request -> isDispatched ( ) ) { if ( $ dispatchLoopCount ++ > 99 ) { throw new Exception \ InfiniteLoopException ( sprintf ( 'Could not ultimately dispatch the request after %d i...
Try processing the request until it is successfully marked dispatched
58,738
protected function resolveController ( RequestInterface $ request ) { $ controllerObjectName = $ request -> getControllerObjectName ( ) ; if ( $ controllerObjectName === '' ) { $ exceptionMessage = 'No controller could be resolved which would match your request' ; if ( $ request instanceof ActionRequest ) { $ exception...
Finds and instantiates a controller that matches the current request . If no controller can be found an instance of NotFoundControllerInterface is returned .
58,739
public function get ( string $ entryIdentifier ) { if ( $ entryIdentifier !== basename ( $ entryIdentifier ) ) { throw new \ InvalidArgumentException ( 'The specified entry identifier must not contain a path segment.' , 1334756877 ) ; } $ pathAndFilename = $ this -> cacheDirectory . $ entryIdentifier . $ this -> cacheE...
Loads data from a cache file .
58,740
private function tryRemoveWithLock ( string $ fileName ) : bool { if ( strncasecmp ( PHP_OS , 'WIN' , 3 ) == 0 ) { return unlink ( $ fileName ) ; } $ file = fopen ( $ fileName , 'rb' ) ; if ( $ file === false ) { return false ; } $ result = false ; if ( flock ( $ file , LOCK_EX ) !== false ) { $ result = unlink ( $ fil...
Try to remove a file and make sure it is not locked .
58,741
protected function findCacheFilesByIdentifier ( string $ entryIdentifier ) { $ pathAndFilename = $ this -> cacheDirectory . $ entryIdentifier . $ this -> cacheEntryFileExtension ; return ( file_exists ( $ pathAndFilename ) ? [ $ pathAndFilename ] : false ) ; }
Tries to find the cache entry for the specified identifier .
58,742
public function requireOnce ( string $ entryIdentifier ) { $ pathAndFilename = $ this -> cacheDirectory . $ entryIdentifier . $ this -> cacheEntryFileExtension ; if ( $ entryIdentifier !== basename ( $ entryIdentifier ) ) { throw new \ InvalidArgumentException ( 'The specified entry identifier (' . $ entryIdentifier . ...
Loads PHP code from the cache and include_onces it right away .
58,743
public function current ( ) { if ( $ this -> cacheFilesIterator === null ) { $ this -> rewind ( ) ; } $ pathAndFilename = $ this -> cacheFilesIterator -> getPathname ( ) ; return $ this -> readCacheFile ( $ pathAndFilename ) ; }
Returns the data of the current cache entry pointed to by the cache entry iterator .
58,744
public function next ( ) { if ( $ this -> cacheFilesIterator === null ) { $ this -> rewind ( ) ; } $ this -> cacheFilesIterator -> next ( ) ; while ( $ this -> cacheFilesIterator -> isDot ( ) && $ this -> cacheFilesIterator -> valid ( ) ) { $ this -> cacheFilesIterator -> next ( ) ; } }
Move forward to the next cache entry
58,745
public function valid ( ) : bool { if ( $ this -> cacheFilesIterator === null ) { $ this -> rewind ( ) ; } return $ this -> cacheFilesIterator -> valid ( ) ; }
Checks if the current position of the cache entry iterator is valid
58,746
protected function readCacheFile ( string $ cacheEntryPathAndFilename , int $ offset = null , int $ maxlen = null ) { for ( $ i = 0 ; $ i < 3 ; $ i ++ ) { $ data = false ; try { $ file = fopen ( $ cacheEntryPathAndFilename , 'rb' ) ; if ( $ file === false ) { continue ; } if ( flock ( $ file , LOCK_SH ) !== false ) { i...
Reads the cache data from the given cache file using locking .
58,747
protected function writeCacheFile ( string $ cacheEntryPathAndFilename , string $ data ) { for ( $ i = 0 ; $ i < 3 ; $ i ++ ) { $ result = false ; try { $ file = fopen ( $ cacheEntryPathAndFilename , 'wb' ) ; if ( $ file === false ) { continue ; } if ( flock ( $ file , LOCK_EX ) !== false ) { $ result = fwrite ( $ file...
Writes the cache data into the given cache file using locking .
58,748
public function setup ( ) : Result { $ result = new Result ( ) ; try { $ this -> configureCacheDirectory ( ) ; } catch ( Exception $ exception ) { $ result -> addError ( new Error ( 'Failed to configure cache directory: %s' , $ exception -> getCode ( ) , [ $ exception -> getMessage ( ) ] , 'Cache Directory' ) ) ; } ret...
Sets up this backend by creating the required cache directory if it doesn t exist yet
58,749
public function getStatus ( ) : Result { $ result = new Result ( ) ; try { $ this -> verifyCacheDirectory ( ) ; } catch ( Exception $ exception ) { $ result -> addError ( new Error ( $ exception -> getMessage ( ) , $ exception -> getCode ( ) , [ ] , 'Cache Directory' ) ) ; return $ result ; } $ result -> addNotice ( ne...
Validates that the configured cache directory exists and is writeable and returns some details about its configuration if that s the case
58,750
public function setParentRoles ( array $ parentRoles ) { $ this -> parentRoles = [ ] ; foreach ( $ parentRoles as $ parentRole ) { $ this -> addParentRole ( $ parentRole ) ; } }
Assign parent roles to this role .
58,751
public function setPrivileges ( array $ privileges ) { foreach ( $ privileges as $ privilege ) { $ this -> privileges [ $ privilege -> getCacheEntryIdentifier ( ) ] = $ privilege ; } }
Assign privileges to this role .
58,752
public static function prepareHeaders ( ResponseInterface $ response ) : array { $ preparedHeaders = [ ] ; $ statusHeader = rtrim ( self :: generateStatusLine ( $ response ) , "\r\n" ) ; $ preparedHeaders [ ] = $ statusHeader ; $ headers = $ response -> getHeaders ( ) ; if ( $ headers instanceof Headers ) { $ preparedH...
Prepare array of header lines for this response
58,753
protected function isValid ( $ value ) { if ( ! is_array ( $ value ) && ! ( $ value instanceof \ Countable ) ) { $ this -> addError ( 'The given subject was not countable.' , 1253718666 ) ; return ; } $ minimum = intval ( $ this -> options [ 'minimum' ] ) ; $ maximum = intval ( $ this -> options [ 'maximum' ] ) ; if ( ...
The given value is valid if it is an array or \ Countable that contains the specified amount of elements .
58,754
public function extractFullyQualifiedClassName ( ) { $ fullyQualifiedClassName = $ this -> extractClassName ( ) ; if ( $ fullyQualifiedClassName === null ) { return null ; } $ namespace = $ this -> extractNamespace ( ) ; if ( $ namespace !== null ) { $ fullyQualifiedClassName = $ namespace . '\\' . $ fullyQualifiedClas...
Extracts the Fully Qualified Class name from the given PHP code
58,755
public function extractNamespace ( ) { $ namespaceParts = [ ] ; $ tokens = token_get_all ( $ this -> phpCode ) ; $ numberOfTokens = count ( $ tokens ) ; for ( $ i = 0 ; $ i < $ numberOfTokens ; $ i ++ ) { $ token = $ tokens [ $ i ] ; if ( is_string ( $ token ) || $ token [ 0 ] !== T_NAMESPACE ) { continue ; } for ( ++ ...
Extracts the PHP namespace from the given PHP code
58,756
protected function createRoutesFromConfiguration ( ) { if ( $ this -> routesCreated === true ) { return ; } $ this -> initializeRoutesConfiguration ( ) ; $ this -> routes = [ ] ; $ routesWithHttpMethodConstraints = [ ] ; foreach ( $ this -> routesConfiguration as $ routeConfiguration ) { $ route = new Route ( ) ; if ( ...
Creates \ Neos \ Flow \ Mvc \ Routing \ Route objects from the injected routes configuration .
58,757
protected function initializeRoutesConfiguration ( ) { if ( $ this -> routesConfiguration === null ) { $ this -> routesConfiguration = $ this -> configurationManager -> getConfiguration ( ConfigurationManager :: CONFIGURATION_TYPE_ROUTES ) ; } }
Checks if a routes configuration was set and otherwise loads the configuration from the configuration manager .
58,758
public function invoke ( ) { $ reason = '' ; $ privilegeSubject = new MethodPrivilegeSubject ( $ this -> joinPoint ) ; try { $ this -> authenticationManager -> authenticate ( ) ; } catch ( EntityNotFoundException $ exception ) { throw new AuthenticationRequiredException ( 'Could not authenticate. Looks like a broken se...
Invokes the security interception
58,759
protected function renderDecisionReasonMessage ( $ privilegeReasonMessage ) { if ( count ( $ this -> securityContext -> getRoles ( ) ) === 0 ) { $ rolesMessage = 'No authenticated roles' ; } else { $ rolesMessage = 'Authenticated roles: ' . implode ( ', ' , array_keys ( $ this -> securityContext -> getRoles ( ) ) ) ; }...
Returns a string message giving insights what happened during privilege evaluation .
58,760
public function updateCredentials ( ActionRequest $ actionRequest ) { if ( $ actionRequest -> getHttpRequest ( ) -> getMethod ( ) !== 'POST' ) { return ; } $ postArguments = $ actionRequest -> getInternalArguments ( ) ; $ password = ObjectAccess :: getPropertyPath ( $ postArguments , '__authentication.Neos.Flow.Securit...
Updates the password credential from the POST vars if the POST parameters are available . Sets the authentication status to AUTHENTICATION_NEEDED if credentials have been sent .
58,761
public function initializeAvailableProxyClasses ( ApplicationContext $ context = null ) { if ( $ context === null ) { return ; } $ proxyClasses = @ include ( FLOW_PATH_TEMPORARY_BASE . '/' . ( string ) $ context . '/AvailableProxyClasses.php' ) ; if ( $ proxyClasses !== false ) { $ this -> availableProxyClasses = $ pro...
Initialize available proxy classes from the cached list .
58,762
protected function registerRenderMethodArguments ( ) { foreach ( static :: getRenderMethodArgumentDefinitions ( $ this -> objectManager ) as $ argumentName => $ definition ) { $ this -> argumentDefinitions [ $ argumentName ] = new ArgumentDefinition ( $ definition [ 0 ] , $ definition [ 1 ] , $ definition [ 2 ] , $ def...
Registers render method arguments
58,763
public static function strtotitle ( string $ string ) : string { $ result = '' ; $ splitIntoLowerCaseWords = preg_split ( "/([\n\r\t ])/" , self :: strtolower ( $ string ) , - 1 , PREG_SPLIT_DELIM_CAPTURE ) ; foreach ( $ splitIntoLowerCaseWords as $ delimiterOrValue ) { $ result .= self :: strtoupper ( self :: substr (...
Converts the first character of each word to uppercase and all remaining characters to lowercase .
58,764
public static function parse_url ( string $ url , int $ component = - 1 ) { $ componentsFromUrl = parse_url ( $ url ) ; if ( $ componentsFromUrl === false ) { return false ; } $ encodedUrl = preg_replace_callback ( '%[^:@/?#&=\.]+%usD' , function ( $ matches ) { return urlencode ( $ matches [ 0 ] ) ; } , $ url ) ; $ co...
Parse a URL and return its components UTF - 8 safe
58,765
protected function initializePrivilegeTargets ( ) { if ( ! isset ( $ this -> policyConfiguration [ 'privilegeTargets' ] ) ) { return ; } foreach ( $ this -> policyConfiguration [ 'privilegeTargets' ] as $ privilegeClassName => $ privilegeTargetsConfiguration ) { foreach ( $ privilegeTargetsConfiguration as $ privilegeT...
Initialized all configured privilege targets from the policy definitions
58,766
public function getRoles ( $ includeAbstract = false ) { $ this -> initialize ( ) ; if ( ! $ includeAbstract ) { return array_filter ( $ this -> roles , function ( Role $ role ) { return $ role -> isAbstract ( ) !== true ; } ) ; } return $ this -> roles ; }
Returns an array of all configured roles
58,767
public function getAllPrivilegesByType ( $ type ) { $ this -> initialize ( ) ; $ privileges = [ ] ; foreach ( $ this -> roles as $ role ) { $ privileges = array_merge ( $ privileges , $ role -> getPrivilegesByType ( $ type ) ) ; } return $ privileges ; }
Returns all privileges of the given type
58,768
public function getPrivilegeTargetByIdentifier ( $ privilegeTargetIdentifier ) { $ this -> initialize ( ) ; return isset ( $ this -> privilegeTargets [ $ privilegeTargetIdentifier ] ) ? $ this -> privilegeTargets [ $ privilegeTargetIdentifier ] : null ; }
Returns the privilege target identified by the given string
58,769
public function mapToObject ( array $ objectData ) { if ( $ objectData === [ ] ) { throw new Exception \ InvalidObjectDataException ( 'The array with object data was empty, probably object not found or access denied.' , 1277974338 ) ; } if ( $ this -> persistenceSession -> hasIdentifier ( $ objectData [ 'identifier' ] ...
Maps a single record into the object it represents and registers it as reconstituted with the session .
58,770
public function thawProperties ( $ object , $ identifier , array $ objectData ) { $ classSchema = $ this -> reflectionService -> getClassSchema ( $ objectData [ 'classname' ] ) ; foreach ( $ objectData [ 'properties' ] as $ propertyName => $ propertyData ) { if ( ! $ classSchema -> hasProperty ( $ propertyName ) || $ c...
Sets the given properties on the object .
58,771
protected function mapArray ( array $ arrayValues = null ) { if ( $ arrayValues === null ) { return [ ] ; } $ array = [ ] ; foreach ( $ arrayValues as $ arrayValue ) { if ( $ arrayValue [ 'value' ] === null ) { $ array [ $ arrayValue [ 'index' ] ] = null ; } else { switch ( $ arrayValue [ 'type' ] ) { case 'integer' : ...
Maps an array proxy structure back to a native PHP array
58,772
protected function mapSplObjectStorage ( array $ objectStorageValues = null , $ createLazySplObjectStorage = false ) { if ( $ objectStorageValues === null ) { return new \ SplObjectStorage ( ) ; } if ( $ createLazySplObjectStorage ) { $ objectIdentifiers = [ ] ; foreach ( $ objectStorageValues as $ arrayValue ) { if ( ...
Maps an SplObjectStorage proxy record back to an SplObjectStorage
58,773
public static function getProperty ( $ subject , $ propertyName , bool $ forceDirectAccess = false ) { if ( ! is_object ( $ subject ) && ! is_array ( $ subject ) ) { throw new \ InvalidArgumentException ( '$subject must be an object or array, ' . gettype ( $ subject ) . ' given.' , 1237301367 ) ; } if ( ! is_string ( $...
Get a property of a given object or array .
58,774
protected static function getPropertyInternal ( $ subject , string $ propertyName , bool $ forceDirectAccess , bool & $ propertyExists ) { if ( $ subject === null ) { return null ; } if ( is_array ( $ subject ) ) { $ propertyExists = array_key_exists ( $ propertyName , $ subject ) ; return $ propertyExists ? $ subject ...
Gets a property of a given object or array .
58,775
public static function setProperty ( & $ subject , $ propertyName , $ propertyValue , bool $ forceDirectAccess = false ) : bool { if ( is_array ( $ subject ) ) { $ subject [ $ propertyName ] = $ propertyValue ; return true ; } if ( ! is_object ( $ subject ) ) { throw new \ InvalidArgumentException ( 'subject must be an...
Set a property for a given object .
58,776
public static function isPropertySettable ( $ object , string $ propertyName ) : bool { if ( ! is_object ( $ object ) ) { throw new \ InvalidArgumentException ( '$object must be an object, ' . gettype ( $ object ) . ' given.' , 1259828920 ) ; } $ className = TypeHandling :: getTypeForValue ( $ object ) ; if ( ( $ objec...
Tells if the value of the specified property can be set by this Object Accessor .
58,777
public static function isPropertyGettable ( $ object , string $ propertyName ) : bool { if ( ! is_object ( $ object ) ) { throw new \ InvalidArgumentException ( '$object must be an object, ' . gettype ( $ object ) . ' given.' , 1259828921 ) ; } if ( ( $ object instanceof \ ArrayAccess && $ object -> offsetExists ( $ pr...
Tells if the value of the specified property can be retrieved by this Object Accessor .
58,778
public function initializeObject ( ) { if ( $ this -> cache -> has ( $ this -> cacheKey ) ) { $ this -> parsedData = $ this -> cache -> get ( $ this -> cacheKey ) ; } else { $ this -> parsedData = $ this -> parseFiles ( $ this -> sourcePaths ) ; $ this -> parsedData = $ this -> resolveAliases ( $ this -> parsedData , '...
When it s called CLDR file is parsed or cache is loaded if available .
58,779
public function getRawData ( $ path ) { if ( $ path === '/' ) { return $ this -> parsedData ; } $ pathElements = explode ( '/' , trim ( $ path , '/' ) ) ; $ data = $ this -> parsedData ; foreach ( $ pathElements as $ key ) { if ( isset ( $ data [ $ key ] ) ) { $ data = $ data [ $ key ] ; } else { return false ; } } ret...
Returns multi - dimensional array representing desired node and it s children or a string value if the path points to a leaf .
58,780
public function getRawArray ( $ path ) { $ data = $ this -> getRawData ( $ path ) ; if ( ! is_array ( $ data ) ) { return false ; } return $ data ; }
Returns multi - dimensional array representing desired node and it s children .
58,781
public function getElement ( $ path ) { $ data = $ this -> getRawData ( $ path ) ; if ( is_array ( $ data ) ) { return false ; } else { return $ data ; } }
Returns string value from a path given .
58,782
public function findNodesWithinPath ( $ path , $ nodeName ) { $ data = $ this -> getRawArray ( $ path ) ; if ( $ data === false ) { return false ; } $ filteredData = [ ] ; foreach ( $ data as $ nodeString => $ children ) { if ( $ this -> getNodeName ( $ nodeString ) === $ nodeName ) { $ filteredData [ $ nodeString ] = ...
Returns all nodes with given name found within given path
58,783
public static function getNodeName ( $ nodeString ) { $ positionOfFirstAttribute = strpos ( $ nodeString , '[@' ) ; if ( $ positionOfFirstAttribute === false ) { return $ nodeString ; } return substr ( $ nodeString , 0 , $ positionOfFirstAttribute ) ; }
Returns node name extracted from node string
58,784
public static function getAttributeValue ( $ nodeString , $ attributeName ) { $ attributeName = '[@' . $ attributeName . '="' ; $ positionOfAttributeName = strpos ( $ nodeString , $ attributeName ) ; if ( $ positionOfAttributeName === false ) { return false ; } $ positionOfAttributeValue = $ positionOfAttributeName + s...
Parses the node string and returns a value of attribute for name provided .
58,785
protected function parseFiles ( array $ sourcePaths ) { $ parsedFiles = [ ] ; foreach ( $ sourcePaths as $ sourcePath ) { $ parsedFiles [ ] = $ this -> cldrParser -> getParsedData ( $ sourcePath ) ; } $ parsedData = $ parsedFiles [ 0 ] ; $ parsedFilesCount = count ( $ parsedFiles ) ; for ( $ i = 1 ; $ i < $ parsedFiles...
Parses given CLDR files using CldrParser and merges parsed data .
58,786
protected function mergeTwoParsedFiles ( $ firstParsedData , $ secondParsedData ) { $ mergedData = $ firstParsedData ; if ( is_array ( $ secondParsedData ) ) { foreach ( $ secondParsedData as $ nodeString => $ children ) { if ( isset ( $ firstParsedData [ $ nodeString ] ) ) { $ mergedData [ $ nodeString ] = $ this -> m...
Merges two sets of data from two separate CLDR files into one array .
58,787
protected function resolveAliases ( $ data , $ currentPath ) { if ( ! is_array ( $ data ) ) { return $ data ; } foreach ( $ data as $ nodeString => $ nodeChildren ) { if ( self :: getNodeName ( $ nodeString ) === 'alias' ) { if ( self :: getAttributeValue ( $ nodeString , 'source' ) !== 'locale' ) { break ; } $ sourceP...
Resolves any alias nodes in parsed CLDR data .
58,788
public function round ( $ subject , $ precision = 0 ) { if ( ! is_numeric ( $ subject ) ) { return NAN ; } $ subject = floatval ( $ subject ) ; if ( $ precision != null && ! is_int ( $ precision ) ) { return NAN ; } return round ( $ subject , $ precision ) ; }
Rounds the subject to the given precision
58,789
public function trunc ( $ x ) { $ sign = $ this -> sign ( $ x ) ; switch ( $ sign ) { case - 1 : return ceil ( $ x ) ; case 1 : return floor ( $ x ) ; default : return $ sign ; } }
Get the integral part of the given number by removing any fractional digits
58,790
public function initialize ( array $ options ) { foreach ( $ options as $ optionName => $ optionValue ) { $ methodName = 'set' . ucfirst ( $ optionName ) ; if ( method_exists ( $ this , $ methodName ) ) { $ this -> $ methodName ( $ optionValue ) ; } } }
Initializes the backend
58,791
protected function persistObjects ( ) { $ this -> visitedDuringPersistence = new \ SplObjectStorage ( ) ; foreach ( $ this -> aggregateRootObjects as $ object ) { $ this -> persistObject ( $ object , null ) ; } foreach ( $ this -> changedEntities as $ object ) { $ this -> persistObject ( $ object , null ) ; } }
First persist new objects then check reconstituted entities .
58,792
protected function persistObject ( $ object , $ parentIdentifier ) { if ( isset ( $ this -> visitedDuringPersistence [ $ object ] ) ) { return $ this -> visitedDuringPersistence [ $ object ] ; } $ identifier = $ this -> persistenceSession -> getIdentifierByObject ( $ object ) ; $ this -> visitedDuringPersistence [ $ ob...
Stores or updates an object in the underlying storage .
58,793
protected function processDeletedObjects ( ) { foreach ( $ this -> deletedEntities as $ entity ) { if ( $ this -> persistenceSession -> hasObject ( $ entity ) ) { $ this -> removeEntity ( $ entity ) ; $ this -> persistenceSession -> unregisterReconstitutedEntity ( $ entity ) ; $ this -> persistenceSession -> unregister...
Iterate over deleted entities and process them
58,794
protected function flattenValue ( $ identifier , $ object , $ propertyName , array $ propertyMetaData , array & $ propertyData ) { $ propertyValue = ObjectAccess :: getProperty ( $ object , $ propertyName , true ) ; if ( $ propertyValue instanceof PersistenceMagicInterface ) { $ propertyData [ $ propertyName ] = [ 'typ...
Convert a value to the internal object data format
58,795
protected function removeDeletedReference ( $ object , $ propertyName , $ propertyMetaData ) { $ previousValue = $ this -> persistenceSession -> getCleanStateOfProperty ( $ object , $ propertyName ) ; if ( $ previousValue !== null && is_array ( $ previousValue ) && isset ( $ previousValue [ 'value' ] [ 'identifier' ] )...
Remove any unreferenced non aggregate root entity
58,796
protected function checkPropertyValue ( $ object , $ propertyName , array $ propertyMetaData ) { $ propertyValue = ObjectAccess :: getProperty ( $ object , $ propertyName , true ) ; $ propertyType = $ propertyMetaData [ 'type' ] ; if ( $ propertyType === 'ArrayObject' ) { throw new PersistenceException ( 'ArrayObject p...
Check the property value for allowed types and throw exceptions for unsupported types .
58,797
protected function processArray ( array $ array = null , $ parentIdentifier , array $ previousArray = null ) { if ( $ previousArray !== null && is_array ( $ previousArray [ 'value' ] ) ) { $ this -> removeDeletedArrayEntries ( $ array , $ previousArray [ 'value' ] ) ; } if ( $ array === null ) { return null ; } $ value...
Store an array as a set of records with each array element becoming a property named like the key and the value .
58,798
protected function processNestedArray ( $ parentIdentifier , array $ nestedArray , \ Closure $ handler = null ) { $ identifier = 'a' . Algorithms :: generateRandomString ( 23 ) ; $ data = [ 'multivalue' => true , 'value' => $ this -> processArray ( $ nestedArray , $ parentIdentifier ) ] ; if ( $ handler instanceof \ Cl...
Serializes a nested array for storage .
58,799
protected function arrayContainsObject ( array $ array , $ object , $ identifier ) { if ( in_array ( $ object , $ array , true ) === true ) { return true ; } foreach ( $ array as $ value ) { if ( $ value instanceof $ object && $ this -> persistenceSession -> getIdentifierByObject ( $ value ) === $ identifier ) { return...
Checks whether the given object is contained in the array . This checks for object identity in terms of the persistence layer i . e . the UUID when comparing entities .