@@ -2,11 +2,11 @@ discard block |
||
2 | 2 | |
3 | 3 | namespace HnrAzevedo\Router; |
4 | 4 | |
5 | -trait ExtraJobsTrait{ |
|
5 | +trait ExtraJobsTrait { |
|
6 | 6 | |
7 | 7 | public function before($walking): Router |
8 | 8 | { |
9 | - return $this->setOnRoute($walking,'before'); |
|
9 | + return $this->setOnRoute($walking, 'before'); |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | public static function beforeAll($walking, $except = null): Router |
@@ -14,12 +14,12 @@ discard block |
||
14 | 14 | $excepts = is_array($except) ? $except : [$except]; |
15 | 15 | self::getInstance()->beforeExcepts = $excepts; |
16 | 16 | self::getInstance()->beforeAll = $walking; |
17 | - return self::getInstance()->setOnRoutes($walking,'beforeAll',$excepts); |
|
17 | + return self::getInstance()->setOnRoutes($walking, 'beforeAll', $excepts); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | public function after($walking): Router |
21 | 21 | { |
22 | - return $this->setOnRoute($walking,'after'); |
|
22 | + return $this->setOnRoute($walking, 'after'); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | public static function afterAll($walking, $except = null): Router |
@@ -27,17 +27,17 @@ discard block |
||
27 | 27 | $excepts = is_array($except) ? $except : [$except]; |
28 | 28 | self::getInstance()->afterExcepts = $excepts; |
29 | 29 | self::getInstance()->afterAll = $walking; |
30 | - return self::getInstance()->setOnRoutes($walking,'afterAll',$excepts); |
|
30 | + return self::getInstance()->setOnRoutes($walking, 'afterAll', $excepts); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | private function setOnRoute($walking, string $state): Router |
34 | 34 | { |
35 | - if($this->lastReturn !== null){ |
|
35 | + if ($this->lastReturn !== null) { |
|
36 | 36 | $currentGroup = end($this->routers)['group']; |
37 | 37 | |
38 | 38 | foreach ($this->routers as $key => $value) { |
39 | 39 | |
40 | - if($value['group'] === $currentGroup){ |
|
40 | + if ($value['group'] === $currentGroup) { |
|
41 | 41 | $this->routers[$key][$state] = $walking; |
42 | 42 | } |
43 | 43 | |
@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | |
52 | 52 | private function setOnRoutes($walking, string $state, array $excepts): Router |
53 | 53 | { |
54 | - foreach($this->routers as $r => $route){ |
|
55 | - if(!in_array($this->routers,$excepts)){ |
|
54 | + foreach ($this->routers as $r => $route) { |
|
55 | + if (!in_array($this->routers, $excepts)) { |
|
56 | 56 | $this->routers[$r][$state] = $walking; |
57 | 57 | } |
58 | 58 | } |