|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace App\Http; |
|
4
|
|
|
|
|
5
|
|
|
use Rudra\Router; |
|
6
|
|
|
|
|
7
|
|
|
class Route |
|
8
|
|
|
{ |
|
9
|
|
|
|
|
10
|
|
|
protected $token; |
|
11
|
|
|
|
|
12
|
|
|
public function __construct(Router $router, string $namespace) |
|
13
|
|
|
{ |
|
14
|
|
|
$router->setNamespace($namespace); |
|
|
|
|
|
|
15
|
|
|
|
|
16
|
|
|
$router->annotation('MainController'); // mainpage |
|
17
|
|
|
|
|
18
|
|
|
$router->middleware('get', [ |
|
19
|
|
|
'pattern' => '123/123', |
|
20
|
|
|
'controller' => 'MainController', |
|
21
|
|
|
'method' => 'actionIndex', |
|
22
|
|
|
'middleware' => [ |
|
23
|
|
|
['\\App\\Http\\Middleware\\MainMiddleware::namespace', ['int' => 1]], |
|
24
|
|
|
['\\App\\Http\\Middleware\\MainMiddleware::namespace', ['int' => 2]], |
|
25
|
|
|
['\\App\\Http\\Middleware\\MainMiddleware::namespace', ['int' => 3]], |
|
26
|
|
|
['\\App\\Http\\Middleware\\MainMiddleware::namespace', ['int' => 4]] |
|
27
|
|
|
], |
|
28
|
|
|
|
|
29
|
|
|
'after_middleware' => [ |
|
30
|
|
|
['\\App\\Http\\Middleware\\MainMiddleware::namespace', ['int' => 5]], |
|
31
|
|
|
['\\App\\Http\\Middleware\\MainMiddleware::namespace', ['int' => 6]], |
|
32
|
|
|
['\\App\\Http\\Middleware\\MainMiddleware::namespace', ['int' => 7]], |
|
33
|
|
|
['\\App\\Http\\Middleware\\MainMiddleware::namespace', ['int' => 8]] |
|
34
|
|
|
] |
|
35
|
|
|
] |
|
36
|
|
|
); |
|
37
|
|
|
|
|
38
|
|
|
$router->middleware('get', [ |
|
39
|
|
|
'pattern' => '123/122', |
|
40
|
|
|
'controller' => 'MainController', |
|
41
|
|
|
'method' => 'actionIndex', |
|
42
|
|
|
'middleware' => [ |
|
43
|
|
|
['MainMiddleware', ['int' => 1]], |
|
44
|
|
|
['MainMiddleware', ['int' => 2]], |
|
45
|
|
|
['MainMiddleware', ['int' => 3]], |
|
46
|
|
|
['MainMiddleware', ['int' => 4]] |
|
47
|
|
|
], |
|
48
|
|
|
|
|
49
|
|
|
'after_middleware' => [ |
|
50
|
|
|
['MainMiddleware', ['int' => 5]], |
|
51
|
|
|
['MainMiddleware', ['int' => 6]], |
|
52
|
|
|
['MainMiddleware', ['int' => 7]], |
|
53
|
|
|
['MainMiddleware', ['int' => 8]] |
|
54
|
|
|
] |
|
55
|
|
|
]); |
|
56
|
|
|
|
|
57
|
|
|
$this->token = $router->isToken(); |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
public function getToken() |
|
61
|
|
|
{ |
|
62
|
|
|
return $this->token; |
|
63
|
|
|
} |
|
64
|
|
|
} |
|
65
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.