eZPublishCommunityProject  2012.12
eZ\Publish\Core\Repository\URLWildcardService Class Reference
+ Inheritance diagram for eZ\Publish\Core\Repository\URLWildcardService:
+ Collaboration diagram for eZ\Publish\Core\Repository\URLWildcardService:

Public Member Functions

 __construct (RepositoryInterface $repository, Handler $urlWildcardHandler, array $settings=array())
 Setups service with reference to repository object that created it & corresponding handler. More...
 
 create ($sourceUrl, $destinationUrl, $forward=false)
 Creates a new url wildcard. More...
 
 load ($id)
 Loads a url wild card. More...
 
 loadAll ($offset=0, $limit=-1)
 Loads all url wild card (paged) More...
 
 remove (URLWildcard $urlWildcard)
 removes an url wildcard More...
 
 translate ($url)
 Translates an url to an existing uri resource based on the source/destination patterns of the url wildcard. More...
 

Protected Member Functions

 cleanUrl ($url)
 Removes leading and trailing slashes and spaces. More...
 

Protected Attributes

 $repository
 
 $settings
 
 $urlWildcardHandler
 

Private Member Functions

 buildSpecificityScoreMap (array $spiUrlWildcards)
 Map by specificity. More...
 
 buildUrlWildcardDomainObject (SPIUrlWildcard $wildcard)
 Builds API UrlWildcard object from given SPI UrlWildcard object. More...
 
 compile ($sourceUrl)
 Compiles the given url pattern into a regular expression. More...
 
 match ($url, SPIUrlWildcard $wildcard)
 Tests if the given url matches against the given url wildcard. More...
 
 substitute ($destinationUrl, array $values)
 Substitutes all placeholders ({}) in the given $destinationUrl with the values from the given $values array. More...
 

Constructor & Destructor Documentation

eZ\Publish\Core\Repository\URLWildcardService::__construct ( RepositoryInterface  $repository,
Handler  $urlWildcardHandler,
array  $settings = array() 
)

Setups service with reference to repository object that created it & corresponding handler.

Parameters
\eZ\Publish\API\Repository\Repository$repository
\eZ\Publish\SPI\Persistence\Content\UrlWildcard\Handler$urlWildcardHandler
array$settings

Member Function Documentation

eZ\Publish\Core\Repository\URLWildcardService::buildSpecificityScoreMap ( array  $spiUrlWildcards)
private

Map by specificity.

Parameters
\eZ\Publish\SPI\Persistence\Content\UrlWildcard[]$spiUrlWildcards
Todo:
use or remove
Returns
array
eZ\Publish\Core\Repository\URLWildcardService::buildUrlWildcardDomainObject ( SPIUrlWildcard  $wildcard)
private

Builds API UrlWildcard object from given SPI UrlWildcard object.

Parameters
\eZ\Publish\SPI\Persistence\Content\UrlWildcard$wildcard
Returns

Referenced by eZ\Publish\Core\Repository\URLWildcardService\create(), eZ\Publish\Core\Repository\URLWildcardService\load(), and eZ\Publish\Core\Repository\URLWildcardService\loadAll().

eZ\Publish\Core\Repository\URLWildcardService::cleanUrl (   $url)
protected

Removes leading and trailing slashes and spaces.

Parameters
string$url
Returns
string

Referenced by eZ\Publish\Core\Repository\URLWildcardService\create().

eZ\Publish\Core\Repository\URLWildcardService::compile (   $sourceUrl)
private

Compiles the given url pattern into a regular expression.

Parameters
string$sourceUrl
Returns
string

Referenced by eZ\Publish\Core\Repository\URLWildcardService\match().

eZ\Publish\Core\Repository\URLWildcardService::create (   $sourceUrl,
  $destinationUrl,
  $forward = false 
)

Creates a new url wildcard.

Exceptions
\eZ\Publish\API\Repository\Exceptions\InvalidArgumentExceptionif the $sourceUrl pattern already exists
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the user is not allowed to create url wildcards
\eZ\Publish\API\Repository\Exceptions\ContentValidationExceptionif the number of "*" patterns in $sourceUrl and the numbers in {} placeholders in $destinationUrl does not match.
Parameters
string$sourceUrl
string$destinationUrl
boolean$forward
Returns

Implements eZ\Publish\API\Repository\URLWildcardService.

eZ\Publish\Core\Repository\URLWildcardService::load (   $id)

Loads a url wild card.

Exceptions
\eZ\Publish\API\Repository\Exceptions\NotFoundExceptionif the url wild card was not found
Parameters
mixed$id
Returns

Implements eZ\Publish\API\Repository\URLWildcardService.

eZ\Publish\Core\Repository\URLWildcardService::loadAll (   $offset = 0,
  $limit = -1 
)

Loads all url wild card (paged)

Parameters
int$offset
int$limit
Returns
[]

Implements eZ\Publish\API\Repository\URLWildcardService.

eZ\Publish\Core\Repository\URLWildcardService::match (   $url,
SPIUrlWildcard  $wildcard 
)
private

Tests if the given url matches against the given url wildcard.

if the wildcard matches on the given url this method will return a ready to use destination url, otherwise this method will return NULL.

Parameters
string$url
\eZ\Publish\SPI\Persistence\Content\UrlWildcard$wildcard
Returns
null|string

Referenced by eZ\Publish\Core\Repository\URLWildcardService\translate().

eZ\Publish\Core\Repository\URLWildcardService::remove ( URLWildcard  $urlWildcard)

removes an url wildcard

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the user is not allowed to remove url wildcards
Parameters
\eZ\Publish\API\Repository\Values\Content\UrlWildcard$urlWildcardthe url wildcard to remove

Implements eZ\Publish\API\Repository\URLWildcardService.

eZ\Publish\Core\Repository\URLWildcardService::substitute (   $destinationUrl,
array  $values 
)
private

Substitutes all placeholders ({}) in the given $destinationUrl with the values from the given $values array.

Parameters
string$destinationUrl
array$values
Returns
string

Referenced by eZ\Publish\Core\Repository\URLWildcardService\match().

eZ\Publish\Core\Repository\URLWildcardService::translate (   $url)

Translates an url to an existing uri resource based on the source/destination patterns of the url wildcard.

Exceptions
\eZ\Publish\API\Repository\Exceptions\NotFoundExceptionif the url could not be translated
Parameters
mixed$url
Returns

Implements eZ\Publish\API\Repository\URLWildcardService.

Member Data Documentation

eZ\Publish\Core\Repository\URLWildcardService::$repository
protected
eZ\Publish\Core\Repository\URLWildcardService::$settings
protected
eZ\Publish\Core\Repository\URLWildcardService::$urlWildcardHandler
protected

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