1 | <?php |
||
22 | abstract class CompositeUrlRule extends Object implements UrlRuleInterface |
||
23 | { |
||
24 | /** |
||
25 | * @var UrlRuleInterface[] the URL rules contained in this composite rule. |
||
26 | * This property is set in [[init()]] by the return value of [[createRules()]]. |
||
27 | */ |
||
28 | protected $rules = []; |
||
29 | /** |
||
30 | * @var int|null status of the URL creation after the last [[createUrl()]] call. |
||
31 | * @since 2.0.12 |
||
32 | */ |
||
33 | protected $createStatus; |
||
34 | |||
35 | |||
36 | /** |
||
37 | * Creates the URL rules that should be contained within this composite rule. |
||
38 | * @return UrlRuleInterface[] the URL rules |
||
39 | */ |
||
40 | abstract protected function createRules(); |
||
41 | |||
42 | /** |
||
43 | * @inheritdoc |
||
44 | */ |
||
45 | 13 | public function init() |
|
50 | |||
51 | /** |
||
52 | * @inheritdoc |
||
53 | */ |
||
54 | 1 | public function parseRequest($manager, $request) |
|
55 | { |
||
56 | 1 | foreach ($this->rules as $rule) { |
|
57 | /* @var $rule UrlRule */ |
||
58 | 1 | $result = $rule->parseRequest($manager, $request); |
|
59 | 1 | if (YII_DEBUG) { |
|
60 | 1 | Yii::trace([ |
|
61 | 1 | 'rule' => method_exists($rule, '__toString') ? $rule->__toString() : get_class($rule), |
|
62 | 'match' => $result !== false, |
||
63 | 'parent' => self::class |
||
64 | 1 | ], __METHOD__); |
|
65 | } |
||
66 | 1 | if ($result !== false) { |
|
67 | 1 | return $result; |
|
68 | } |
||
69 | } |
||
70 | |||
71 | 1 | return false; |
|
72 | } |
||
73 | |||
74 | /** |
||
75 | * @inheritdoc |
||
76 | */ |
||
77 | 1 | public function createUrl($manager, $route, $params) |
|
91 | |||
92 | /** |
||
93 | * Iterates through specified rules and calls [[createUrl()]] for each of them. |
||
94 | * |
||
95 | * @param UrlRuleInterface[] $rules rules to iterate. |
||
96 | * @param UrlManager $manager the URL manager |
||
97 | * @param string $route the route. It should not have slashes at the beginning or the end. |
||
98 | * @param array $params the parameters |
||
99 | * @return bool|string the created URL, or `false` if none of specified rules cannot be used for creating this URL. |
||
100 | * @see createUrl() |
||
101 | * @since 2.0.12 |
||
102 | */ |
||
103 | 10 | protected function iterateRules($rules, $manager, $route, $params) |
|
125 | |||
126 | /** |
||
127 | * Returns status of the URL creation after the last [[createUrl()]] call. |
||
128 | * |
||
129 | * For multiple rules statuses will be combined by bitwise `or` operator |
||
130 | * (e.g. `UrlRule::CREATE_STATUS_PARSING_ONLY | UrlRule::CREATE_STATUS_PARAMS_MISMATCH`). |
||
131 | * |
||
132 | * @return null|int Status of the URL creation after the last [[createUrl()]] call. `null` if rule does not provide |
||
133 | * info about create status. |
||
134 | * @see $createStatus |
||
135 | * @see http://php.net/manual/en/language.operators.bitwise.php |
||
136 | * @since 2.0.12 |
||
137 | */ |
||
138 | 3 | public function getCreateUrlStatus() |
|
142 | } |
||
143 |
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.