Class craft\web\UrlRule
- Inheritance
- craft\web\UrlRule » yii\web\UrlRule » yii\base\BaseObject
- Implements
- yii\base\Configurable, yii\web\UrlRuleInterface
- Subclasses
- craft\app\web\UrlRule
- Available since version
- 3.0
- Source Code
- https://github.com/craftcms/cms/blob/master/src/web/UrlRule.php
Property | Type | Description | Defined By |
---|---|---|---|
$defaults |
array | The default GET parameters (name => value) that this rule provides. | yii\web\UrlRule |
$encodeParams |
boolean | A value indicating if parameters should be url encoded. | yii\web\UrlRule |
$host |
string | The pattern used to parse and create the host info part of a URL (e.g. `http://example. | yii\web\UrlRule |
$mode |
integer | A value indicating if this rule should be used for both request parsing and URL creation, parsing only, or creation only. | yii\web\UrlRule |
$name |
string | The name of this rule. | yii\web\UrlRule |
$normalizer |
yii\web\UrlNormalizer, array, false, null | The configuration for yii\web\UrlNormalizer used by this rule. | yii\web\UrlRule |
$params |
array | Parameters that should be passed to the controller. | craft\web\UrlRule |
$pattern |
string | The pattern used to parse and create the path info part of a URL. | yii\web\UrlRule |
$route |
string | The route to the controller action | yii\web\UrlRule |
$suffix |
string | The URL suffix used for this rule. | yii\web\UrlRule |
$verb |
string, array | The HTTP verb (e.g. GET, POST, DELETE) that this rule should match. | yii\web\UrlRule |
Property | Type | Description | Defined By |
---|---|---|---|
$createStatus |
integer, null | Status of the URL creation after the last createUrl() call. | yii\web\UrlRule |
$placeholders |
array | List of placeholders for matching parameters names. | yii\web\UrlRule |
Method | Description | Defined By |
---|---|---|
__call() |
Calls the named method which is not a class method. | yii\base\BaseObject |
__construct() |
Constructor. | craft\web\UrlRule |
__get() |
Returns the value of an object property. | yii\base\BaseObject |
__isset() |
Checks if a property is set, i.e. defined and not null. | yii\base\BaseObject |
__set() |
Sets value of an object property. | yii\base\BaseObject |
__toString() |
yii\web\UrlRule | |
__unset() |
Sets an object property to null. | yii\base\BaseObject |
canGetProperty() |
Returns a value indicating whether a property can be read. | yii\base\BaseObject |
canSetProperty() |
Returns a value indicating whether a property can be set. | yii\base\BaseObject |
className() |
Returns the fully qualified name of this class. | yii\base\BaseObject |
createUrl() |
Creates a URL according to the given route and parameters. | yii\web\UrlRule |
getCreateUrlStatus() |
Returns status of the URL creation after the last createUrl() call. | yii\web\UrlRule |
hasMethod() |
Returns a value indicating whether a method is defined. | yii\base\BaseObject |
hasProperty() |
Returns a value indicating whether a property is defined. | yii\base\BaseObject |
init() |
Initializes the object. | yii\base\BaseObject |
parseRequest() |
Parses the given request and returns the corresponding route and parameters. | craft\web\UrlRule |
Method | Description | Defined By |
---|---|---|
getNormalizer() |
yii\web\UrlRule | |
getParamRules() |
Returns list of regex for matching parameter. | yii\web\UrlRule |
hasNormalizer() |
yii\web\UrlRule | |
substitutePlaceholderNames() |
Iterates over $placeholders and checks whether each placeholder exists as a key in $matches array. | yii\web\UrlRule |
Constant | Value | Description | Defined By |
---|---|---|---|
CREATE_STATUS_PARAMS_MISMATCH |
4 | Represents the unsuccessful URL generation by last createUrl() call, because of mismatched or missing parameters. | yii\web\UrlRule |
CREATE_STATUS_PARSING_ONLY |
1 | Represents the unsuccessful URL generation by last createUrl() call, because rule does not support creating URLs. | yii\web\UrlRule |
CREATE_STATUS_ROUTE_MISMATCH |
2 | Represents the unsuccessful URL generation by last createUrl() call, because of mismatched route. | yii\web\UrlRule |
CREATE_STATUS_SUCCESS |
0 | Represents the successful URL generation by last createUrl() call. | yii\web\UrlRule |
CREATION_ONLY |
2 | Set $mode with this value to mark that this rule is for URL creation only. | yii\web\UrlRule |
PARSING_ONLY |
1 | Set $mode with this value to mark that this rule is for URL parsing only. | yii\web\UrlRule |
Property Details
$params
public property
#
Parameters that should be passed to the controller.
public array $params = []
Method Details
__construct()
public method
#
Constructor.
public void __construct ( array $config = [] )
$config |
array |
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.
|
---|