Passed
Push — master ( 47c627...033b76 )
by Anton
02:34
created
src/Domain/GuardInterceptor.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
     {
48 48
         $permission = $this->getPermissions($controller, $action);
49 49
 
50
-        if ($permission !== null && !$this->guard->allows($permission[0], $parameters)) {
50
+        if ($permission !== null && !$this->guard->allows($permission[0], $parameters)){
51 51
             throw new ControllerException(
52 52
                 sprintf(
53 53
                     'Unauthorized permission `%s` for action `%s`->`%s`',
@@ -74,14 +74,14 @@  discard block
 block discarded – undo
74 74
     private function getPermissions(string $controller, string $action): ?array
75 75
     {
76 76
         $key = sprintf('%s:%s', $controller, $action);
77
-        if (array_key_exists($key, $this->cache)) {
77
+        if (array_key_exists($key, $this->cache)){
78 78
             return $this->cache[$key];
79 79
         }
80 80
 
81 81
         $this->cache[$key] = null;
82
-        try {
82
+        try{
83 83
             $method = new \ReflectionMethod($controller, $action);
84
-        } catch (\ReflectionException $e) {
84
+        }catch (\ReflectionException $e){
85 85
             return null;
86 86
         }
87 87
 
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
             Guarded::class
100 100
         );
101 101
 
102
-        if ($action === null) {
102
+        if ($action === null){
103 103
             return null;
104 104
         }
105 105
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
             ControllerException::FORBIDDEN
122 122
         ];
123 123
 
124
-        if ($guarded->permission === null && $ns === null) {
124
+        if ($guarded->permission === null && $ns === null){
125 125
             throw new InterceptorException(sprintf(
126 126
                 'Unable to apply @Guarded without name or @GuardNamespace on `%s`->`%s`',
127 127
                 $method->getDeclaringClass()->getName(),
@@ -129,11 +129,11 @@  discard block
 block discarded – undo
129 129
             ));
130 130
         }
131 131
 
132
-        if ($ns !== null) {
132
+        if ($ns !== null){
133 133
             $permission[0] = sprintf('%s.%s', $ns->namespace, $permission[0]);
134 134
         }
135 135
 
136
-        switch ($guarded->else) {
136
+        switch ($guarded->else){
137 137
             case 'badAction':
138 138
                 $permission[1] = ControllerException::BAD_ACTION;
139 139
                 break;
Please login to merge, or discard this patch.