@@ -41,7 +41,7 @@ |
||
41 | 41 | { |
42 | 42 | $permission = $this->permissions->getPermission($controller, $action); |
43 | 43 | |
44 | - if ($permission !== null && !$this->guard->allows($permission[0], $parameters)) { |
|
44 | + if ($permission !== null && !$this->guard->allows($permission[0], $parameters)){ |
|
45 | 45 | throw new ControllerException($permission[2], $permission[1]); |
46 | 46 | } |
47 | 47 |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | public function getPermission(string $controller, string $action): ?array |
47 | 47 | { |
48 | 48 | $key = sprintf('%s:%s', $controller, $action); |
49 | - if (!array_key_exists($key, $this->cache)) { |
|
49 | + if (!array_key_exists($key, $this->cache)){ |
|
50 | 50 | $this->cache[$key] = $this->generatePermission($controller, $action); |
51 | 51 | } |
52 | 52 | |
@@ -55,20 +55,20 @@ discard block |
||
55 | 55 | |
56 | 56 | private function generatePermission(string $controller, string $action): ?array |
57 | 57 | { |
58 | - try { |
|
58 | + try{ |
|
59 | 59 | $method = new \ReflectionMethod($controller, $action); |
60 | - } catch (\ReflectionException $e) { |
|
60 | + }catch (\ReflectionException $e){ |
|
61 | 61 | return null; |
62 | 62 | } |
63 | 63 | |
64 | 64 | $guarded = $this->reader->getMethodAnnotation($method, Guarded::class); |
65 | - if (!$guarded instanceof Guarded) { |
|
65 | + if (!$guarded instanceof Guarded){ |
|
66 | 66 | return null; |
67 | 67 | } |
68 | 68 | |
69 | 69 | $namespace = $this->reader->getClassAnnotation($method->getDeclaringClass(), GuardNamespace::class); |
70 | 70 | |
71 | - if ($guarded->permission || ($namespace instanceof GuardNamespace && $namespace->namespace)) { |
|
71 | + if ($guarded->permission || ($namespace instanceof GuardNamespace && $namespace->namespace)){ |
|
72 | 72 | return [ |
73 | 73 | $this->makePermission($guarded, $method, $namespace), |
74 | 74 | $this->mapFailureException($guarded), |
@@ -91,11 +91,11 @@ discard block |
||
91 | 91 | private function makePermission(Guarded $guarded, \ReflectionMethod $method, ?GuardNamespace $ns): string |
92 | 92 | { |
93 | 93 | $permission = []; |
94 | - if ($this->namespace) { |
|
94 | + if ($this->namespace){ |
|
95 | 95 | $permission[] = $this->namespace; |
96 | 96 | } |
97 | 97 | |
98 | - if ($ns !== null && $ns->namespace) { |
|
98 | + if ($ns !== null && $ns->namespace){ |
|
99 | 99 | $permission[] = $ns->namespace; |
100 | 100 | } |
101 | 101 |