eZPublishCommunityProject  2012.12
eZ\Publish\Core\REST\Common\UrlHandler\Pattern Class Reference

Pattern based URL Handler. More...

+ Inheritance diagram for eZ\Publish\Core\REST\Common\UrlHandler\Pattern:
+ Collaboration diagram for eZ\Publish\Core\REST\Common\UrlHandler\Pattern:

Public Member Functions

 __construct (array $map=array())
 Construct from optional initial map. More...
 
 addPattern ($type, $pattern)
 Adds a pattern for a type. More...
 
 generate ($type, array $values=array())
 Generate a URL of the given type from the specified values. More...
 
 parse ($type, $url)
 Parse URL and return the IDs contained in the URL. More...
 

Public Attributes

const SLASHES_VARIABLE_REGEX = '\{(?:\&\s*)([A-Za-z-_]+)\}'
 Pattern regular sub-expression that might contain slashes. More...
 
const STANDARD_VARIABLE_REGEX = '\{([A-Za-z-_]+)\}'
 Pattern regular sub-expression. More...
 

Protected Member Functions

 compile ($pattern)
 Compiles a given pattern to a PCRE regular expression. More...
 

Protected Attributes

 $compileCache = array()
 
 $map = array()
 

Detailed Description

Pattern based URL Handler.

Handles 2 types of patterns to be used in an URL:

  • {foo} matches anything but a slash and is used to match the typical URL variable (e.g. an ID)
  • {&foo} matches the slash, too, and is used to match only those URL variables, which may have a slash

Constructor & Destructor Documentation

eZ\Publish\Core\REST\Common\UrlHandler\Pattern::__construct ( array  $map = array())

Construct from optional initial map.

Parameters
array$map

Member Function Documentation

eZ\Publish\Core\REST\Common\UrlHandler\Pattern::addPattern (   $type,
  $pattern 
)

Adds a pattern for a type.

Parameters
string$type
string$pattern

Referenced by eZ\Publish\Core\REST\Common\UrlHandler\Pattern\__construct().

eZ\Publish\Core\REST\Common\UrlHandler\Pattern::compile (   $pattern)
protected

Compiles a given pattern to a PCRE regular expression.

Parameters
string$pattern
Returns
string

Referenced by eZ\Publish\Core\REST\Common\UrlHandler\Pattern\parse().

eZ\Publish\Core\REST\Common\UrlHandler\Pattern::generate (   $type,
array  $values = array() 
)

Generate a URL of the given type from the specified values.

Parameters
string$type
array$values
Returns
string

Implements eZ\Publish\Core\REST\Common\UrlHandler.

eZ\Publish\Core\REST\Common\UrlHandler\Pattern::parse (   $type,
  $url 
)

Parse URL and return the IDs contained in the URL.

Parameters
string$type
string$url
Returns
array

Implements eZ\Publish\Core\REST\Common\UrlHandler.

Member Data Documentation

eZ\Publish\Core\REST\Common\UrlHandler\Pattern::$compileCache = array()
protected
eZ\Publish\Core\REST\Common\UrlHandler\Pattern::$map = array()
protected
const eZ\Publish\Core\REST\Common\UrlHandler\Pattern::SLASHES_VARIABLE_REGEX = '\{(?:\&\s*)([A-Za-z-_]+)\}'

Pattern regular sub-expression that might contain slashes.

const eZ\Publish\Core\REST\Common\UrlHandler\Pattern::STANDARD_VARIABLE_REGEX = '\{([A-Za-z-_]+)\}'

Pattern regular sub-expression.


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