W3cubDocs

/Yii 2.0

Abstract Class yii\web\CompositeUrlRule

Inheritance yii\web\CompositeUrlRule » yii\base\Object
Implements yii\base\Configurable, yii\web\UrlRuleInterface
Subclasses yii\rest\UrlRule, yii\web\GroupUrlRule
Available since version 2.0
Source Code https://github.com/yiisoft/yii2/blob/master/framework/web/CompositeUrlRule.php

CompositeUrlRule is the base class for URL rule classes that consist of multiple simpler rules.

Public Properties

Property Type Description Defined By
$createUrlStatus null|integer Status of the URL creation after the last createUrl() call. yii\web\CompositeUrlRule

Protected Properties

Property Type Description Defined By
$createStatus integer|null Status of the URL creation after the last createUrl() call. yii\web\CompositeUrlRule
$rules yii\web\UrlRuleInterface[] The URL rules contained in this composite rule. yii\web\CompositeUrlRule

Public Methods

Method Description Defined By
__call() Calls the named method which is not a class method. yii\base\Object
__construct() Constructor. yii\base\Object
__get() Returns the value of an object property. yii\base\Object
__isset() Checks if a property is set, i.e. defined and not null. yii\base\Object
__set() Sets value of an object property. yii\base\Object
__unset() Sets an object property to null. yii\base\Object
canGetProperty() Returns a value indicating whether a property can be read. yii\base\Object
canSetProperty() Returns a value indicating whether a property can be set. yii\base\Object
className() Returns the fully qualified name of this class. yii\base\Object
createUrl() Creates a URL according to the given route and parameters. yii\web\CompositeUrlRule
getCreateUrlStatus() Returns status of the URL creation after the last createUrl() call. yii\web\CompositeUrlRule
hasMethod() Returns a value indicating whether a method is defined. yii\base\Object
hasProperty() Returns a value indicating whether a property is defined. yii\base\Object
init() Initializes the object. yii\web\CompositeUrlRule
parseRequest() Parses the given request and returns the corresponding route and parameters. yii\web\CompositeUrlRule

Protected Methods

Method Description Defined By
createRules() Creates the URL rules that should be contained within this composite rule. yii\web\CompositeUrlRule
iterateRules() Iterates through specified rules and calls createUrl() for each of them. yii\web\CompositeUrlRule

Property Details

$createStatus protected property (available since version 2.0.12)

Status of the URL creation after the last createUrl() call.

protected integer|null $createStatus = null

$createUrlStatus public read-only property

Status of the URL creation after the last createUrl() call. null if rule does not provide info about create status.

public null|integer getCreateUrlStatus ( )

$rules protected property

The URL rules contained in this composite rule. This property is set in init() by the return value of createRules().

protected yii\web\UrlRuleInterface[] $rules = []

Method Details

createRules() protected abstract method

Creates the URL rules that should be contained within this composite rule.

protected abstract yii\web\UrlRuleInterface[] createRules ( )
return yii\web\UrlRuleInterface[]

The URL rules

createUrl() public method

Creates a URL according to the given route and parameters.

public string|boolean createUrl ( $manager, $route, $params )
$manager yii\web\UrlManager

The URL manager

$route string

The route. It should not have slashes at the beginning or the end.

$params array

The parameters

return string|boolean

The created URL, or false if this rule cannot be used for creating this URL.

getCreateUrlStatus() public method (available since version 2.0.12)

Returns status of the URL creation after the last createUrl() call.

For multiple rules statuses will be combined by bitwise or operator (e.g. UrlRule::CREATE_STATUS_PARSING_ONLY | UrlRule::CREATE_STATUS_PARAMS_MISMATCH).

See also:

public null|integer getCreateUrlStatus ( )
return null|integer

Status of the URL creation after the last createUrl() call. null if rule does not provide info about create status.

init() public method

Initializes the object.

This method is invoked at the end of the constructor after the object is initialized with the given configuration.

public void init ( )

iterateRules() protected method (available since version 2.0.12)

Iterates through specified rules and calls createUrl() for each of them.

See also createUrl().

protected boolean|string iterateRules ( $rules, $manager, $route, $params )
$rules yii\web\UrlRuleInterface[]

Rules to iterate.

$manager yii\web\UrlManager

The URL manager

$route string

The route. It should not have slashes at the beginning or the end.

$params array

The parameters

return boolean|string

The created URL, or false if none of specified rules cannot be used for creating this URL.

parseRequest() public method

Parses the given request and returns the corresponding route and parameters.

public array|boolean parseRequest ( $manager, $request )
$manager yii\web\UrlManager

The URL manager

$request yii\web\Request

The request component

return array|boolean

The parsing result. The route and the parameters are returned as an array. If false, it means this rule cannot be used to parse this path info.

© 2008–2017 by Yii Software LLC
Licensed under the three clause BSD license.
http://www.yiiframework.com/doc-2.0/yii-web-compositeurlrule.html