1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Facades for Yii 2 |
4
|
|
|
* |
5
|
|
|
* @see https://github.com/sergeymakinen/yii2-facades |
6
|
|
|
* @copyright Copyright (c) 2016 Sergey Makinen (https://makinen.ru) |
7
|
|
|
* @license https://github.com/sergeymakinen/yii2-facades/blob/master/LICENSE The MIT License |
8
|
|
|
*/ |
9
|
|
|
|
10
|
|
|
namespace sergeymakinen\facades; |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* Router facade. |
14
|
|
|
* |
15
|
|
|
* Facades Yii::$app->get('urlManager') component. |
16
|
|
|
* |
17
|
|
|
* @see \yii\web\UrlManager |
18
|
|
|
* @method static addRules(array $rules, bool $append = true) Adds additional URL rules. |
19
|
|
|
* @method static \yii\base\Behavior attachBehavior(string $name, string|array|\yii\base\Behavior $behavior) Attaches a behavior to this component. |
20
|
|
|
* @method static attachBehaviors(array $behaviors) Attaches a list of behaviors to the component. |
21
|
|
|
* @method static array behaviors() Returns a list of behaviors that this component should behave as. |
22
|
|
|
* @method static string createAbsoluteUrl(string|array $params, string $scheme = null) Creates an absolute URL using the given route and query parameters. |
23
|
|
|
* @method static string createUrl(string|array $params) Creates a URL using the given route and query parameters. |
24
|
|
|
* @method static null|\yii\base\Behavior detachBehavior(string $name) Detaches a behavior from the component. |
25
|
|
|
* @method static detachBehaviors() Detaches all behaviors from the component. |
26
|
|
|
* @method static ensureBehaviors() Makes sure that the behaviors declared in [[behaviors()]] are attached to this component. |
27
|
|
|
* @method static string getBaseUrl() Returns the base URL that is used by [[createUrl()]] to prepend to created URLs. |
28
|
|
|
* @method static null|\yii\base\Behavior getBehavior(string $name) Returns the named behavior object. |
29
|
|
|
* @method static \yii\base\Behavior[] getBehaviors() Returns all behaviors attached to this component. |
30
|
|
|
* @method static \yii\caching\Cache|string getCache() Returns the cache object or the application component ID of the cache object. |
31
|
|
|
* @method static bool getEnablePrettyUrl() Returns whether to enable pretty URLs. |
32
|
|
|
* @method static bool getEnableStrictParsing() Returns whether to enable strict parsing. |
33
|
|
|
* @method static string getHostInfo() Returns the host info that is used by [[createAbsoluteUrl()]] to prepend to created URLs. |
34
|
|
|
* @method static string getRouteParam() Returns the GET parameter name for route. |
35
|
|
|
* @method static array getRuleConfig() Returns the default configuration of URL rules. |
36
|
|
|
* @method static array getRules() Returns the rules for creating and parsing URLs when [[enablePrettyUrl]] is true. |
37
|
|
|
* @method static string getScriptUrl() Returns the entry script URL that is used by [[createUrl()]] to prepend to created URLs. |
38
|
|
|
* @method static bool getShowScriptName() Returns whether to show entry script name in the constructed URL. |
39
|
|
|
* @method static string getSuffix() Returns the URL suffix used when in 'path' format. |
40
|
|
|
* @method static bool hasEventHandlers(string $name) Returns a value indicating whether there is any handler attached to the named event. |
41
|
|
|
* @method static bool off(string $name, callable $handler = null) Detaches an existing event handler from this component. |
42
|
|
|
* @method static on(string $name, callable $handler, mixed $data = null, bool $append = true) Attaches an event handler to an event. |
43
|
|
|
* @method static array|bool parseRequest(\yii\web\Request $request) Parses the user request. |
44
|
|
|
* @method static setBaseUrl(string $value) Sets the base URL that is used by [[createUrl()]] to prepend to created URLs. |
45
|
|
|
* @method static setCache(\yii\caching\Cache|string $value) Sets the cache object or the application component ID of the cache object. |
46
|
|
|
* @method static setEnablePrettyUrl(bool $value) Sets whether to enable pretty URLs. |
47
|
|
|
* @method static setEnableStrictParsing(bool $value) Sets whether to enable strict parsing. |
48
|
|
|
* @method static setHostInfo(string $value) Sets the host info that is used by [[createAbsoluteUrl()]] to prepend to created URLs. |
49
|
|
|
* @method static setRouteParam(string $value) Sets the GET parameter name for route. |
50
|
|
|
* @method static setRuleConfig(array $value) Sets the default configuration of URL rules. |
51
|
|
|
* @method static setRules(array $value) Sets the rules for creating and parsing URLs when [[enablePrettyUrl]] is true. |
52
|
|
|
* @method static setScriptUrl(string $value) Sets the entry script URL that is used by [[createUrl()]] to prepend to created URLs. |
53
|
|
|
* @method static setShowScriptName(bool $value) Sets whether to show entry script name in the constructed URL. |
54
|
|
|
* @method static setSuffix(string $value) Sets the URL suffix used when in 'path' format. |
55
|
|
|
* @method static trigger(string $name, \yii\base\Event $event = null) Triggers an event. |
56
|
|
|
*/ |
57
|
|
|
class Router extends Facade |
58
|
|
|
{ |
59
|
|
|
/** |
60
|
|
|
* @inheritdoc |
61
|
|
|
*/ |
62
|
|
|
public static function getFacadeComponentId() |
63
|
|
|
{ |
64
|
|
|
return 'urlManager'; |
65
|
|
|
} |
66
|
|
|
} |
67
|
|
|
|