eZPublish  4.7
eZNamePatternResolver Class Reference

Public Member Functions

 __construct ($namePattern, eZContentObject $contentObject, $contentVersion=false, $contentTranslation=false)
 Constructs a object to resolve $namePattern. More...
 
 resolveNamePattern ($limit=0, $sequence= '')
 Return the real name for an object name pattern. More...
 

Private Member Functions

 extractTokens ($namePattern)
 Extract all tokens from $namePattern. More...
 
 fetchContentAttributes ()
 Fetches the list of available class-identifiers in the token, and it will only fetch the attributes which appear amongst the identifiers found in tokens. More...
 
 filterNamePattern ($namePattern)
 Builds a lookup / translation table for groups in the $namePattern. More...
 
 getIdentifiers ($patternString)
 Returns all identifiers from all tokens in the name pattern. More...
 
 isTokenGroup ($identifier)
 Checks whether $identifier is a placeholder for a token group. More...
 
 resolveToken ($token)
 Looks up the value $token should be replaced with and returns this as a string. More...
 
 tokenParts ($token)
 Return the different constituents of $token in an array. More...
 
 translatePattern ()
 Replaces tokens in the name pattern with their resolved values. More...
 

Private Attributes

 $attributeArray
 
 $contentObject
 
 $groupLookupTable
 
 $metaString = 'EZMETAGROUP_'
 
 $namePattern
 
 $origNamePattern
 
 $translation
 
 $version
 

Constructor & Destructor Documentation

eZNamePatternResolver::__construct (   $namePattern,
eZContentObject  $contentObject,
  $contentVersion = false,
  $contentTranslation = false 
)

Constructs a object to resolve $namePattern.

$contentVersion and $contentTranslation specify which version and translation respectively of the content object to use.

Parameters
string$namePattern
eZContentObject$contentObject
int | false$contentVersion
string | false$contentTranslation

Member Function Documentation

eZNamePatternResolver::extractTokens (   $namePattern)
private

Extract all tokens from $namePattern.

Example: Text <token> more text ==> <token>

Parameters
string$namePattern
Returns
array

Referenced by resolveToken(), and translatePattern().

eZNamePatternResolver::fetchContentAttributes ( )
private

Fetches the list of available class-identifiers in the token, and it will only fetch the attributes which appear amongst the identifiers found in tokens.

Returns
void

Referenced by resolveNamePattern().

eZNamePatternResolver::filterNamePattern (   $namePattern)
private

Builds a lookup / translation table for groups in the $namePattern.

The groups are referenced with a generated meta-token in the original name pattern.

Returns intermediate name pattern where groups are replaced with meta- tokens.

Parameters
string$namePattern
Returns
string

Referenced by __construct().

eZNamePatternResolver::getIdentifiers (   $patternString)
private

Returns all identifiers from all tokens in the name pattern.

Parameters
string$patternString
Returns
array

Referenced by fetchContentAttributes().

eZNamePatternResolver::isTokenGroup (   $identifier)
private

Checks whether $identifier is a placeholder for a token group.

Parameters
string$identifier
Returns
void

Referenced by resolveToken().

eZNamePatternResolver::resolveNamePattern (   $limit = 0,
  $sequence = '' 
)

Return the real name for an object name pattern.

Parameters
int$limitThe limit on the string length, by defaul 0 aka none
string$sequenceEnd sequence applied to string if limit has been reached
Returns
string
eZNamePatternResolver::resolveToken (   $token)
private

Looks up the value $token should be replaced with and returns this as a string.

Meta strings denothing token groups are automatically inferred.

Parameters
string$token
Returns
string

Referenced by translatePattern().

eZNamePatternResolver::tokenParts (   $token)
private

Return the different constituents of $token in an array.

The normal case here is that the different identifiers within one token will be tokenized and returned.

Example: "&lt;title|text&gt;" ==> array( 'title', 'text' )

Parameters
string$token
Returns
array

Referenced by resolveToken().

eZNamePatternResolver::translatePattern ( )
private

Replaces tokens in the name pattern with their resolved values.

Returns
string

Referenced by resolveNamePattern().

Member Data Documentation

eZNamePatternResolver::$attributeArray
private
eZNamePatternResolver::$contentObject
private

Referenced by __construct().

eZNamePatternResolver::$groupLookupTable
private
eZNamePatternResolver::$metaString = 'EZMETAGROUP_'
private
eZNamePatternResolver::$namePattern
private
eZNamePatternResolver::$origNamePattern
private
eZNamePatternResolver::$translation
private
eZNamePatternResolver::$version
private

The documentation for this class was generated from the following file: