PHP Class Visithor\Generator\UrlGenerator

显示文件 Open project: visithor/visithor Class Usage Examples

Protected Properties

Property Type Description
$urlChainFactory Visithor\Factory\UrlChainFactory UrlChain factory
$urlFactory Visithor\Factory\UrlFactory Url factory

Public Methods

Method Description
__construct ( UrlFactory $urlFactory, UrlChainFactory $urlChainFactory ) Construct
generate ( array $config ) : UrlChain Given a configuration array, generates a chain of urls

Protected Methods

Method Description
createUrlChainFromConfig ( array $config, array $defaultHTTPCodes, array $defaultOptions ) : Url[] Given a config array, create an URLChain instance filled with all defined URL instances.
getDefaultHTTPCodes ( array $config ) : string[] Get default http Codes
getDefaultOptions ( array $config ) : array Get default options
getUrlHTTPCodesFromConfig ( mixed $urlConfig, array $defaultHTTPCodes ) : string[] Get url HTTP Codes given its configuration
getUrlInstanceFromConfig ( mixed $urlConfig, array $defaultHTTPCodes, array $defaultOptions, array $profiles ) : URL Get Url instance given its configuration
getUrlOptionsFromConfig ( mixed $urlConfig, array $defaultOptions ) : string[] Get url options
getUrlPathFromConfig ( mixed $urlConfig ) : string Build the url given the configuration data

Method Details

__construct() public method

Construct
public __construct ( UrlFactory $urlFactory, UrlChainFactory $urlChainFactory )
$urlFactory Visithor\Factory\UrlFactory Url factory
$urlChainFactory Visithor\Factory\UrlChainFactory UrlChain factory

createUrlChainFromConfig() protected method

Given a config array, create an URLChain instance filled with all defined URL instances.
protected createUrlChainFromConfig ( array $config, array $defaultHTTPCodes, array $defaultOptions ) : Url[]
$config array Configuration
$defaultHTTPCodes array Array of HTTP Codes
$defaultOptions array Default options
return Visithor\Model\Url[] Array of URL instances

generate() public method

Given a configuration array, generates a chain of urls
public generate ( array $config ) : UrlChain
$config array Configuration
return Visithor\Model\UrlChain Chain of URL instances

getDefaultHTTPCodes() protected method

Get default http Codes
protected getDefaultHTTPCodes ( array $config ) : string[]
$config array Configuration
return string[] Array of HTTP Codes

getDefaultOptions() protected method

Get default options
protected getDefaultOptions ( array $config ) : array
$config array Configuration
return array Default options

getUrlHTTPCodesFromConfig() protected method

Get url HTTP Codes given its configuration
protected getUrlHTTPCodesFromConfig ( mixed $urlConfig, array $defaultHTTPCodes ) : string[]
$urlConfig mixed Url configuration
$defaultHTTPCodes array Array of HTTP Codes
return string[] Set of HTTP Codes

getUrlInstanceFromConfig() protected method

Get Url instance given its configuration
protected getUrlInstanceFromConfig ( mixed $urlConfig, array $defaultHTTPCodes, array $defaultOptions, array $profiles ) : URL
$urlConfig mixed Url configuration
$defaultHTTPCodes array Array of HTTP Codes
$defaultOptions array Default options
$profiles array Profiles
return URL Url instance

getUrlOptionsFromConfig() protected method

Get url options
protected getUrlOptionsFromConfig ( mixed $urlConfig, array $defaultOptions ) : string[]
$urlConfig mixed Url configuration
$defaultOptions array Default options
return string[] Set of HTTP Codes

getUrlPathFromConfig() protected method

Build the url given the configuration data
protected getUrlPathFromConfig ( mixed $urlConfig ) : string
$urlConfig mixed Url configuration
return string Route path

Property Details

$urlChainFactory protected_oe property

UrlChain factory
protected UrlChainFactory,Visithor\Factory $urlChainFactory
return Visithor\Factory\UrlChainFactory

$urlFactory protected_oe property

Url factory
protected UrlFactory,Visithor\Factory $urlFactory
return Visithor\Factory\UrlFactory