PHP Class eZ\Publish\Core\Repository\URLWildcardService

Inheritance: implements eZ\Publish\API\Repository\URLWildcardService
Show file Open project: ezsystems/ezpublish-kernel

Protected Properties

Property Type Description
$repository eZ\Publish\API\Repository\Repository
$settings array
$urlWildcardHandler eZ\Publish\SPI\Persistence\Content\UrlWildcard\Handler

Public Methods

Method Description
__construct ( eZ\Publish\API\Repository\Repository $repository, eZ\Publish\SPI\Persistence\Content\UrlWildcard\Handler $urlWildcardHandler, array $settings = [] ) Setups service with reference to repository object that created it & corresponding handler.
create ( string $sourceUrl, string $destinationUrl, boolean $forward = false ) : eZ\Publish\API\Repository\Values\Content\UrlWildcard Creates a new url wildcard.
load ( mixed $id ) : eZ\Publish\API\Repository\Values\Content\UrlWildcard Loads a url wild card.
loadAll ( integer $offset, integer $limit ) : eZ\Publish\API\Repository\Values\Content\UrlWildcard[] Loads all url wild card (paged).
remove ( eZ\Publish\API\Repository\Values\Content\URLWildcard $urlWildcard ) removes an url wildcard.
translate ( mixed $url ) : eZ\Publish\API\Repository\Values\Content\URLWildcardTranslationResult Translates an url to an existing uri resource based on the source/destination patterns of the url wildcard.

Protected Methods

Method Description
cleanUrl ( string $url ) : string Removes leading and trailing slashes and spaces.

Private Methods

Method Description
buildUrlWildcardDomainObject ( eZ\Publish\SPI\Persistence\Content\UrlWildcard $wildcard ) : eZ\Publish\API\Repository\Values\Content\URLWildcard Builds API UrlWildcard object from given SPI UrlWildcard object.
compile ( string $sourceUrl ) : string Compiles the given url pattern into a regular expression.
match ( string $url, eZ\Publish\SPI\Persistence\Content\UrlWildcard $wildcard ) : null | string Tests if the given url matches against the given url wildcard.
substitute ( string $destinationUrl, array $values ) : string Substitutes all placeholders ({\d}) in the given $destinationUrl with the values from the given $values array.

Method Details

__construct() public method

Setups service with reference to repository object that created it & corresponding handler.
public __construct ( eZ\Publish\API\Repository\Repository $repository, eZ\Publish\SPI\Persistence\Content\UrlWildcard\Handler $urlWildcardHandler, array $settings = [] )
$repository eZ\Publish\API\Repository\Repository
$urlWildcardHandler eZ\Publish\SPI\Persistence\Content\UrlWildcard\Handler
$settings array

cleanUrl() protected method

Removes leading and trailing slashes and spaces.
protected cleanUrl ( string $url ) : string
$url string
return string

create() public method

Creates a new url wildcard.
public create ( string $sourceUrl, string $destinationUrl, boolean $forward = false ) : eZ\Publish\API\Repository\Values\Content\UrlWildcard
$sourceUrl string
$destinationUrl string
$forward boolean
return eZ\Publish\API\Repository\Values\Content\UrlWildcard

load() public method

Loads a url wild card.
public load ( mixed $id ) : eZ\Publish\API\Repository\Values\Content\UrlWildcard
$id mixed
return eZ\Publish\API\Repository\Values\Content\UrlWildcard

loadAll() public method

Loads all url wild card (paged).
public loadAll ( integer $offset, integer $limit ) : eZ\Publish\API\Repository\Values\Content\UrlWildcard[]
$offset integer
$limit integer
return eZ\Publish\API\Repository\Values\Content\UrlWildcard[]

remove() public method

removes an url wildcard.
public remove ( eZ\Publish\API\Repository\Values\Content\URLWildcard $urlWildcard )
$urlWildcard eZ\Publish\API\Repository\Values\Content\URLWildcard the url wildcard to remove

translate() public method

Translates an url to an existing uri resource based on the source/destination patterns of the url wildcard.
public translate ( mixed $url ) : eZ\Publish\API\Repository\Values\Content\URLWildcardTranslationResult
$url mixed
return eZ\Publish\API\Repository\Values\Content\URLWildcardTranslationResult

Property Details

$repository protected property

protected Repository,eZ\Publish\API\Repository $repository
return eZ\Publish\API\Repository\Repository

$settings protected property

protected array $settings
return array

$urlWildcardHandler protected property

protected Handler,eZ\Publish\SPI\Persistence\Content\UrlWildcard $urlWildcardHandler
return eZ\Publish\SPI\Persistence\Content\UrlWildcard\Handler