@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | { |
53 | 53 | $permission = $this->getPermissions($controller, $action); |
54 | 54 | |
55 | - if ($permission !== null && !$this->guard->allows($permission[0], $parameters)) { |
|
55 | + if ($permission !== null && !$this->guard->allows($permission[0], $parameters)){ |
|
56 | 56 | throw new ControllerException( |
57 | 57 | sprintf( |
58 | 58 | 'Unauthorized permission `%s` for action `%s`->`%s`', |
@@ -79,14 +79,14 @@ discard block |
||
79 | 79 | private function getPermissions(string $controller, string $action): ?array |
80 | 80 | { |
81 | 81 | $key = sprintf('%s:%s', $controller, $action); |
82 | - if (array_key_exists($key, $this->cache)) { |
|
82 | + if (array_key_exists($key, $this->cache)){ |
|
83 | 83 | return $this->cache[$key]; |
84 | 84 | } |
85 | 85 | |
86 | 86 | $this->cache[$key] = null; |
87 | - try { |
|
87 | + try{ |
|
88 | 88 | $method = new \ReflectionMethod($controller, $action); |
89 | - } catch (\ReflectionException $e) { |
|
89 | + }catch (\ReflectionException $e){ |
|
90 | 90 | return null; |
91 | 91 | } |
92 | 92 | |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | Guarded::class |
105 | 105 | ); |
106 | 106 | |
107 | - if ($action === null) { |
|
107 | + if ($action === null){ |
|
108 | 108 | return null; |
109 | 109 | } |
110 | 110 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | ControllerException::FORBIDDEN |
127 | 127 | ]; |
128 | 128 | |
129 | - if ($guarded->permission === null && $ns === null) { |
|
129 | + if ($guarded->permission === null && $ns === null){ |
|
130 | 130 | throw new InterceptorException( |
131 | 131 | sprintf( |
132 | 132 | 'Unable to apply @Guarded without name or @GuardNamespace on `%s`->`%s`', |
@@ -136,16 +136,16 @@ discard block |
||
136 | 136 | ); |
137 | 137 | } |
138 | 138 | |
139 | - if ($ns !== null) { |
|
139 | + if ($ns !== null){ |
|
140 | 140 | $permission[0] = sprintf('%s.%s', $ns->namespace, $permission[0]); |
141 | 141 | } |
142 | 142 | |
143 | - if ($this->namespace !== null) { |
|
143 | + if ($this->namespace !== null){ |
|
144 | 144 | // global namespace |
145 | 145 | $permission[0] = sprintf('%s.%s', $this->namespace, $permission[0]); |
146 | 146 | } |
147 | 147 | |
148 | - switch ($guarded->else) { |
|
148 | + switch ($guarded->else){ |
|
149 | 149 | case 'unauthorized': |
150 | 150 | $permission[1] = ControllerException::UNAUTHORIZED; |
151 | 151 | break; |