|
@@ -29,9 +29,10 @@ discard block |
|
|
block discarded – undo |
|
29
|
29
|
*/ |
|
30
|
30
|
public function globalMiddleware() |
|
31
|
31
|
{ |
|
32
|
|
- if (isset($this->router->collection->middleware['global_middleware'])) |
|
33
|
|
- foreach ($this->router->collection->middleware['global_middleware'] as $class) |
|
34
|
|
- if (class_exists($class)) $this->callHandler($class); |
|
|
32
|
+ if (isset($this->router->collection->middleware['global_middleware'])) {
|
|
|
33
|
+ foreach ($this->router->collection->middleware['global_middleware'] as $class) |
|
|
34
|
+ if (class_exists($class)) $this->callHandler($class);
|
|
|
35
|
+ }
|
|
35
|
36
|
} |
|
36
|
37
|
|
|
37
|
38
|
/** |
|
@@ -39,9 +40,10 @@ discard block |
|
|
block discarded – undo |
|
39
|
40
|
*/ |
|
40
|
41
|
public function blockMiddleware() |
|
41
|
42
|
{ |
|
42
|
|
- if (isset($this->router->collection->middleware['block_middleware'])) |
|
43
|
|
- if (isset($this->router->collection->middleware['block_middleware'][$this->router->route->getTarget('block')]) && class_exists($this->router->collection->middleware['block_middleware'][$this->router->route->getTarget('block')])) { |
|
44
|
|
- $class = $this->router->collection->middleware['block_middleware'][$this->router->route->getTarget('block')]; |
|
|
43
|
+ if (isset($this->router->collection->middleware['block_middleware'])) {
|
|
|
44
|
+ if (isset($this->router->collection->middleware['block_middleware'][$this->router->route->getTarget('block')]) && class_exists($this->router->collection->middleware['block_middleware'][$this->router->route->getTarget('block')])) { |
|
|
45
|
+ $class = $this->router->collection->middleware['block_middleware'][$this->router->route->getTarget('block')];
|
|
|
46
|
+ }
|
|
45
|
47
|
$this->callHandler($class); |
|
46
|
48
|
} |
|
47
|
49
|
} |
|
@@ -65,9 +67,10 @@ discard block |
|
|
block discarded – undo |
|
65
|
67
|
*/ |
|
66
|
68
|
public function routeMiddleware() |
|
67
|
69
|
{ |
|
68
|
|
- if (isset($this->router->collection->middleware['route_middleware'])) |
|
69
|
|
- if (isset($this->router->route->getPath()['middleware']) && class_exists($this->router->collection->middleware['route_middleware'][$this->router->route->getPath()['middleware']])) { |
|
70
|
|
- $class = $this->router->collection->middleware['route_middleware'][$this->router->route->getPath()['middleware']]; |
|
|
70
|
+ if (isset($this->router->collection->middleware['route_middleware'])) {
|
|
|
71
|
+ if (isset($this->router->route->getPath()['middleware']) && class_exists($this->router->collection->middleware['route_middleware'][$this->router->route->getPath()['middleware']])) { |
|
|
72
|
+ $class = $this->router->collection->middleware['route_middleware'][$this->router->route->getPath()['middleware']];
|
|
|
73
|
+ }
|
|
71
|
74
|
$this->callHandler($class); |
|
72
|
75
|
} |
|
73
|
76
|
} |
|
@@ -81,9 +84,10 @@ discard block |
|
|
block discarded – undo |
|
81
|
84
|
if (method_exists($instance, 'handle')) { |
|
82
|
85
|
$reflectionMethod = new ReflectionMethod($instance, 'handle'); |
|
83
|
86
|
$dependencies = []; |
|
84
|
|
- foreach ($reflectionMethod->getParameters() as $arg) |
|
85
|
|
- if (!is_null($arg->getClass())) |
|
86
|
|
- $dependencies[] = $this->getClass($arg->getClass()->name); |
|
|
87
|
+ foreach ($reflectionMethod->getParameters() as $arg) {
|
|
|
88
|
+ if (!is_null($arg->getClass())) |
|
|
89
|
+ $dependencies[] = $this->getClass($arg->getClass()->name);
|
|
|
90
|
+ }
|
|
87
|
91
|
$dependencies = array_merge($dependencies, [$this->router->route]); |
|
88
|
92
|
$reflectionMethod->invokeArgs($instance, $dependencies); |
|
89
|
93
|
} |