kernel/classes/eznamepatternresolver.php

Show: inherited
Table of Contents

File containing the eZNamePatternResolver class

Copyright
Copyright (C) 1999-2011 eZ Systems AS. All rights reserved.  
License
eZ Business Use License Agreement Version 2.0  
Package
kernel  
Version
4.6.0  

\eZNamePatternResolver

Package: kernel

eZNamePatternResolver is a utility class for resolving object name and url alias patterns.

This code supports object name pattern groups.

Syntax:

<attribute_identifier>
<attribute_identifier> <2nd-identifier>
User text <attribute_identifier>|(<2nd-identifier><3rd-identifier>)

Example:

<nickname|(<firstname> <lastname>)>

Tokens are looked up from left to right. If a match is found for the leftmost token, the 2nd token will not be used. Tokens are representations of attributes. So a match means that that the current attribute has data.

tokens are the class attribute identifiers which are used in the class edit-interface.

Version
4.6.0  

Properties

Propertyprivate\array(string=>string)  $attributeArray= ''

Holds data fetched from content object attributes

Details
Type
\array(string=>string)
Propertyprivate\eZContentObject  $contentObject= ''

The content object which holds the attributes used to resolve name pattern.

Details
Type
\eZContentObject
Propertyprivatearray  $groupLookupTable= ''

Holds token groups

Details
Type
array
Propertyprivatestring  $metaString= ''EZMETAGROUP_''

The string to use to signify group tokens.

Default value'EZMETAGROUP_'Details
Type
string
Propertyprivatestring  $namePattern= ''

Holds the filtered name pattern where token groups are replaced with meta strings

Details
Type
string
Propertyprivatestring  $origNamePattern= ''

Contains the original name pattern entered

Details
Type
string
Propertyprivatestring  $translation= ''

Contains the language locale for which to fetch attributes.

Details
Type
string
Propertyprivateint  $version= ''

Version number of the content object to fetch attributes from.

Details
Type
int

Methods

methodpublic__construct( string $namePattern, \eZContentObject $contentObject, int | false $contentVersion = false, string | false $contentTranslation = false ) : void

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

Parameters
Name Type Description
$namePattern string
$contentObject \eZContentObject
$contentVersion int | false
$contentTranslation string | false
methodprivateextractTokens( string $namePattern ) : array

Extract all tokens from $namePattern

Example:

Text <token> more text ==> <token>
Parameters
Name Type Description
$namePattern string
Returns
Type Description
array
methodprivatefetchContentAttributes( ) : void

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.

methodprivatefilterNamePattern( string $namePattern ) : string

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
Name Type Description
$namePattern string
Returns
Type Description
string
methodprivategetIdentifiers( string $patternString ) : array

Returns all identifiers from all tokens in the name pattern.

Parameters
Name Type Description
$patternString string
Returns
Type Description
array
methodprivateisTokenGroup( string $identifier ) : void

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

Parameters
Name Type Description
$identifier string
methodpublicresolveNamePattern( int $limit = 0, string $sequence = '' ) : string

Return the real name for an object name pattern

Parameters
Name Type Description
$limit int

The limit on the string length, by defaul 0 aka none

$sequence string

End sequence applied to string if limit has been reached

Returns
Type Description
string
methodprivateresolveToken( string $token ) : string

Looks up the value $token should be replaced with and returns this as a string. Meta strings denothing token groups are automatically inferred.

Parameters
Name Type Description
$token string
Returns
Type Description
string
methodprivatetokenParts( string $token ) : array

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:

"<title|text>" ==> array( 'title', 'text' )
Parameters
Name Type Description
$token string
Returns
Type Description
array
methodprivatetranslatePattern( ) : string

Replaces tokens in the name pattern with their resolved values.

Returns
Type Description
string
Documentation was generated by DocBlox 0.18.1.