1 | <?php |
||||
2 | |||||
3 | namespace roaresearch\yii2\roa\urlRules; |
||||
4 | |||||
5 | use Yii; |
||||
6 | |||||
7 | /** |
||||
8 | * Default Url Rule to handle resources with collections. |
||||
9 | * |
||||
10 | * Supports representative URL using ownership slug. |
||||
11 | * |
||||
12 | * @author Angel (Faryshta) Guevara <[email protected]> |
||||
13 | */ |
||||
14 | class Resource extends \yii\rest\UrlRule |
||||
15 | { |
||||
16 | /** |
||||
17 | * @inheritdoc |
||||
18 | */ |
||||
19 | public $pluralize = false; |
||||
20 | |||||
21 | /** |
||||
22 | * @inheritdoc |
||||
23 | */ |
||||
24 | public $tokens = ['{id}' => '<id:\d+>']; |
||||
25 | |||||
26 | /** |
||||
27 | * @inheritdoc |
||||
28 | */ |
||||
29 | 18 | public function parseRequest($manager, $request) |
|||
30 | { |
||||
31 | 18 | $pathInfo = $request->getPathInfo(); |
|||
0 ignored issues
–
show
Unused Code
introduced
by
![]() |
|||||
32 | 18 | foreach ($this->rules as $urlName => $rules) { |
|||
33 | 18 | foreach ($rules as $rule) { |
|||
34 | /* @var $rule \yii\web\UrlRule */ |
||||
35 | 18 | $result = $rule->parseRequest($manager, $request); |
|||
36 | 18 | if (YII_DEBUG) { |
|||
37 | 18 | Yii::trace([ |
|||
0 ignored issues
–
show
The function
yii\BaseYii::trace() has been deprecated: since 2.0.14. Use [[debug()]] instead.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This function has been deprecated. The supplier of the function has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead. ![]() |
|||||
38 | 18 | 'rule' => $rule instanceof \Stringable |
|||
39 | 18 | ? (string)$rule |
|||
40 | 18 | : $rule::class, |
|||
41 | 'match' => $result !== false, |
||||
42 | 'parent' => static::class, |
||||
43 | ], __METHOD__); |
||||
44 | } |
||||
45 | 18 | if ($result !== false) { |
|||
46 | 18 | return $result; |
|||
47 | } |
||||
48 | } |
||||
49 | } |
||||
50 | |||||
51 | 14 | return false; |
|||
52 | } |
||||
53 | } |
||||
54 |