Passed
Pull Request — master (#817)
by Aleksei
10:52 queued 03:36
created
src/Router/src/RouteGroup.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
         private readonly ContainerInterface $container,
31 31
         private readonly RouterInterface $router,
32 32
         private readonly UriHandler $handler
33
-    ) {
33
+    ){
34 34
     }
35 35
 
36 36
     /**
@@ -54,9 +54,9 @@  discard block
 block discarded – undo
54 54
         return $this;
55 55
     }
56 56
 
57
-    public function setCore(Autowire|CoreInterface|string $core): self
57
+    public function setCore(Autowire | CoreInterface | string $core): self
58 58
     {
59
-        if (!$core instanceof CoreInterface) {
59
+        if (!$core instanceof CoreInterface){
60 60
             $core = $this->container->get($core);
61 61
         }
62 62
         $this->core = $core;
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
     /**
71 71
      * @param MiddlewareInterface|Autowire|class-string<MiddlewareInterface>|non-empty-string $middleware
72 72
      */
73
-    public function addMiddleware(MiddlewareInterface|Autowire|string $middleware): self
73
+    public function addMiddleware(MiddlewareInterface | Autowire | string $middleware): self
74 74
     {
75 75
         $this->middleware[] = $middleware;
76 76
 
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
      */
88 88
     public function flushRoutes(): void
89 89
     {
90
-        foreach ($this->routes as $name) {
90
+        foreach ($this->routes as $name){
91 91
             $this->router->setRoute($name, $this->applyGroupParams($this->router->getRoute($name)));
92 92
         }
93 93
     }
@@ -106,10 +106,10 @@  discard block
 block discarded – undo
106 106
 
107 107
     private function applyGroupParams(Route $route): Route
108 108
     {
109
-        if ($this->core !== null) {
109
+        if ($this->core !== null){
110 110
             $target = $route->getTarget();
111 111
 
112
-            if ($target instanceof AbstractTarget) {
112
+            if ($target instanceof AbstractTarget){
113 113
                 $route = $route->withTarget($target->withCore($this->core));
114 114
             }
115 115
         }
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -56,7 +56,8 @@  discard block
 block discarded – undo
56 56
 
57 57
     public function setCore(Autowire|CoreInterface|string $core): self
58 58
     {
59
-        if (!$core instanceof CoreInterface) {
59
+        if (!$core instanceof CoreInterface)
60
+        {
60 61
             $core = $this->container->get($core);
61 62
         }
62 63
         $this->core = $core;
@@ -87,7 +88,8 @@  discard block
 block discarded – undo
87 88
      */
88 89
     public function flushRoutes(): void
89 90
     {
90
-        foreach ($this->routes as $name) {
91
+        foreach ($this->routes as $name)
92
+        {
91 93
             $this->router->setRoute($name, $this->applyGroupParams($this->router->getRoute($name)));
92 94
         }
93 95
     }
@@ -106,10 +108,12 @@  discard block
 block discarded – undo
106 108
 
107 109
     private function applyGroupParams(Route $route): Route
108 110
     {
109
-        if ($this->core !== null) {
111
+        if ($this->core !== null)
112
+        {
110 113
             $target = $route->getTarget();
111 114
 
112
-            if ($target instanceof AbstractTarget) {
115
+            if ($target instanceof AbstractTarget)
116
+            {
113 117
                 $route = $route->withTarget($target->withCore($this->core));
114 118
             }
115 119
         }
Please login to merge, or discard this patch.
src/Router/src/UriHandler.php 2 patches
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
         'integer' => '\d+',
26 26
         'uuid'    => '[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}',
27 27
     ];
28
-    private const URI_FIXERS       = [
28
+    private const URI_FIXERS = [
29 29
         '[]'  => '',
30 30
         '[/]' => '',
31 31
         '['   => '',
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
     public function __construct(
50 50
         private readonly UriFactoryInterface $uriFactory,
51 51
         SlugifyInterface $slugify = null
52
-    ) {
52
+    ){
53 53
         $this->slugify = $slugify ?? new Slugify();
54 54
     }
55 55
 
@@ -108,13 +108,13 @@  discard block
 block discarded – undo
108 108
      */
109 109
     public function match(UriInterface $uri, array $defaults): ?array
110 110
     {
111
-        if (!$this->isCompiled()) {
111
+        if (!$this->isCompiled()){
112 112
             $this->compile();
113 113
         }
114 114
 
115 115
         $matches = [];
116 116
 
117
-        if (!\preg_match($this->compiled, $this->fetchTarget($uri), $matches)) {
117
+        if (!\preg_match($this->compiled, $this->fetchTarget($uri), $matches)){
118 118
             return null;
119 119
         }
120 120
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
      */
129 129
     public function uri(iterable $parameters = [], array $defaults = []): UriInterface
130 130
     {
131
-        if (!$this->isCompiled()) {
131
+        if (!$this->isCompiled()){
132 132
             $this->compile();
133 133
         }
134 134
 
@@ -138,8 +138,8 @@  discard block
 block discarded – undo
138 138
             $this->fetchOptions($parameters, $query)
139 139
         );
140 140
 
141
-        foreach ($this->constrains as $key => $_) {
142
-            if (empty($parameters[$key])) {
141
+        foreach ($this->constrains as $key => $_){
142
+            if (empty($parameters[$key])){
143 143
                 throw new UriHandlerException(\sprintf('Unable to generate Uri, parameter `%s` is missing', $key));
144 144
             }
145 145
         }
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
         $path = $this->interpolate($this->template, $parameters);
149 149
 
150 150
         //Uri with added prefix
151
-        $uri = $this->uriFactory->createUri(($this->matchHost ? '' : $this->prefix) . trim($path, '/'));
151
+        $uri = $this->uriFactory->createUri(($this->matchHost ? '' : $this->prefix).trim($path, '/'));
152 152
 
153 153
         return empty($query) ? $uri : $uri->withQuery(\http_build_query($query));
154 154
     }
@@ -163,18 +163,18 @@  discard block
 block discarded – undo
163 163
         $allowed = \array_keys($this->options);
164 164
 
165 165
         $result = [];
166
-        foreach ($parameters as $key => $parameter) {
167
-            if (\is_int($key) && isset($allowed[$key])) {
166
+        foreach ($parameters as $key => $parameter){
167
+            if (\is_int($key) && isset($allowed[$key])){
168 168
                 // this segment fetched keys from given parameters either by name or by position
169 169
                 $key = $allowed[$key];
170
-            } elseif (!\array_key_exists($key, $this->options) && \is_array($parameters)) {
170
+            } elseif (!\array_key_exists($key, $this->options) && \is_array($parameters)){
171 171
                 // all additional parameters given in array form can be glued to query string
172 172
                 $query[$key] = $parameter;
173 173
                 continue;
174 174
             }
175 175
 
176 176
             //String must be normalized here
177
-            if (\is_string($parameter) && !\preg_match('/^[a-z\-_0-9]+$/i', $parameter)) {
177
+            if (\is_string($parameter) && !\preg_match('/^[a-z\-_0-9]+$/i', $parameter)){
178 178
                 $result[$key] = $this->slugify->slugify($parameter);
179 179
                 continue;
180 180
             }
@@ -192,15 +192,15 @@  discard block
 block discarded – undo
192 192
     {
193 193
         $path = $uri->getPath();
194 194
 
195
-        if (empty($path) || $path[0] !== '/') {
196
-            $path = '/' . $path;
195
+        if (empty($path) || $path[0] !== '/'){
196
+            $path = '/'.$path;
197 197
         }
198 198
 
199
-        if ($this->matchHost) {
200
-            $uriString = $uri->getHost() . $path;
201
-        } else {
199
+        if ($this->matchHost){
200
+            $uriString = $uri->getHost().$path;
201
+        }else{
202 202
             $uriString = \substr($path, \strlen($this->prefix));
203
-            if ($uriString === false) {
203
+            if ($uriString === false){
204 204
                 $uriString = '';
205 205
             }
206 206
         }
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
      */
214 214
     private function compile(): void
215 215
     {
216
-        if ($this->pattern === null) {
216
+        if ($this->pattern === null){
217 217
             throw new UriHandlerException('Unable to compile UriHandler, pattern is not set');
218 218
         }
219 219
 
@@ -222,14 +222,14 @@  discard block
 block discarded – undo
222 222
         $pattern = \rtrim(\ltrim($this->pattern, ':/'), '/');
223 223
 
224 224
         // correct [/ first occurrence]
225
-        if (\str_starts_with($pattern, '[/')) {
226
-            $pattern = '[' . \substr($pattern, 2);
225
+        if (\str_starts_with($pattern, '[/')){
226
+            $pattern = '['.\substr($pattern, 2);
227 227
         }
228 228
 
229
-        if (\preg_match_all('/<(\w+):?(.*?)?>/', $pattern, $matches)) {
229
+        if (\preg_match_all('/<(\w+):?(.*?)?>/', $pattern, $matches)){
230 230
             $variables = \array_combine($matches[1], $matches[2]);
231 231
 
232
-            foreach ($variables as $key => $segment) {
232
+            foreach ($variables as $key => $segment){
233 233
                 $segment = $this->prepareSegment($key, $segment);
234 234
                 $replaces[\sprintf('<%s>', $key)] = \sprintf('(?P<%s>%s)', $key, $segment);
235 235
                 $options[] = $key;
@@ -239,13 +239,13 @@  discard block
 block discarded – undo
239 239
         $template = \preg_replace('/<(\w+):?.*?>/', '<\1>', $pattern);
240 240
         $options = \array_fill_keys($options, null);
241 241
 
242
-        foreach ($this->constrains as $key => $value) {
243
-            if ($value instanceof Autofill) {
242
+        foreach ($this->constrains as $key => $value){
243
+            if ($value instanceof Autofill){
244 244
                 // only forces value replacement, not required to be presented as parameter
245 245
                 continue;
246 246
             }
247 247
 
248
-            if (!\array_key_exists($key, $options) && !isset($this->defaults[$key])) {
248
+            if (!\array_key_exists($key, $options) && !isset($this->defaults[$key])){
249 249
                 throw new ConstrainException(
250 250
                     \sprintf(
251 251
                         'Route `%s` does not define routing parameter `<%s>`.',
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
             }
257 257
         }
258 258
 
259
-        $this->compiled = '/^' . \strtr($template, $replaces + self::PATTERN_REPLACES) . '$/iu';
259
+        $this->compiled = '/^'.\strtr($template, $replaces + self::PATTERN_REPLACES).'$/iu';
260 260
         $this->template = \stripslashes(\str_replace('?', '', $template));
261 261
         $this->options = $options;
262 262
     }
@@ -267,9 +267,9 @@  discard block
 block discarded – undo
267 267
     private function interpolate(string $string, array $values): string
268 268
     {
269 269
         $replaces = [];
270
-        foreach ($values as $key => $value) {
270
+        foreach ($values as $key => $value){
271 271
             $replaces[\sprintf('<%s>', $key)] = match (true) {
272
-                $value instanceof \Stringable || \is_scalar($value) => (string) $value,
272
+                $value instanceof \Stringable || \is_scalar($value) => (string)$value,
273 273
                 default => '',
274 274
             };
275 275
         }
Please login to merge, or discard this patch.
Braces   +44 added lines, -21 removed lines patch added patch discarded remove patch
@@ -108,13 +108,15 @@  discard block
 block discarded – undo
108 108
      */
109 109
     public function match(UriInterface $uri, array $defaults): ?array
110 110
     {
111
-        if (!$this->isCompiled()) {
111
+        if (!$this->isCompiled())
112
+        {
112 113
             $this->compile();
113 114
         }
114 115
 
115 116
         $matches = [];
116 117
 
117
-        if (!\preg_match($this->compiled, $this->fetchTarget($uri), $matches)) {
118
+        if (!\preg_match($this->compiled, $this->fetchTarget($uri), $matches))
119
+        {
118 120
             return null;
119 121
         }
120 122
 
@@ -128,7 +130,8 @@  discard block
 block discarded – undo
128 130
      */
129 131
     public function uri(iterable $parameters = [], array $defaults = []): UriInterface
130 132
     {
131
-        if (!$this->isCompiled()) {
133
+        if (!$this->isCompiled())
134
+        {
132 135
             $this->compile();
133 136
         }
134 137
 
@@ -138,8 +141,10 @@  discard block
 block discarded – undo
138 141
             $this->fetchOptions($parameters, $query)
139 142
         );
140 143
 
141
-        foreach ($this->constrains as $key => $_) {
142
-            if (empty($parameters[$key])) {
144
+        foreach ($this->constrains as $key => $_)
145
+        {
146
+            if (empty($parameters[$key]))
147
+            {
143 148
                 throw new UriHandlerException(\sprintf('Unable to generate Uri, parameter `%s` is missing', $key));
144 149
             }
145 150
         }
@@ -163,18 +168,23 @@  discard block
 block discarded – undo
163 168
         $allowed = \array_keys($this->options);
164 169
 
165 170
         $result = [];
166
-        foreach ($parameters as $key => $parameter) {
167
-            if (\is_int($key) && isset($allowed[$key])) {
171
+        foreach ($parameters as $key => $parameter)
172
+        {
173
+            if (\is_int($key) && isset($allowed[$key]))
174
+            {
168 175
                 // this segment fetched keys from given parameters either by name or by position
169 176
                 $key = $allowed[$key];
170
-            } elseif (!\array_key_exists($key, $this->options) && \is_array($parameters)) {
177
+            }
178
+            elseif (!\array_key_exists($key, $this->options) && \is_array($parameters))
179
+            {
171 180
                 // all additional parameters given in array form can be glued to query string
172 181
                 $query[$key] = $parameter;
173 182
                 continue;
174 183
             }
175 184
 
176 185
             //String must be normalized here
177
-            if (\is_string($parameter) && !\preg_match('/^[a-z\-_0-9]+$/i', $parameter)) {
186
+            if (\is_string($parameter) && !\preg_match('/^[a-z\-_0-9]+$/i', $parameter))
187
+            {
178 188
                 $result[$key] = $this->slugify->slugify($parameter);
179 189
                 continue;
180 190
             }
@@ -192,15 +202,20 @@  discard block
 block discarded – undo
192 202
     {
193 203
         $path = $uri->getPath();
194 204
 
195
-        if (empty($path) || $path[0] !== '/') {
205
+        if (empty($path) || $path[0] !== '/')
206
+        {
196 207
             $path = '/' . $path;
197 208
         }
198 209
 
199
-        if ($this->matchHost) {
210
+        if ($this->matchHost)
211
+        {
200 212
             $uriString = $uri->getHost() . $path;
201
-        } else {
213
+        }
214
+        else
215
+        {
202 216
             $uriString = \substr($path, \strlen($this->prefix));
203
-            if ($uriString === false) {
217
+            if ($uriString === false)
218
+            {
204 219
                 $uriString = '';
205 220
             }
206 221
         }
@@ -213,7 +228,8 @@  discard block
 block discarded – undo
213 228
      */
214 229
     private function compile(): void
215 230
     {
216
-        if ($this->pattern === null) {
231
+        if ($this->pattern === null)
232
+        {
217 233
             throw new UriHandlerException('Unable to compile UriHandler, pattern is not set');
218 234
         }
219 235
 
@@ -222,14 +238,17 @@  discard block
 block discarded – undo
222 238
         $pattern = \rtrim(\ltrim($this->pattern, ':/'), '/');
223 239
 
224 240
         // correct [/ first occurrence]
225
-        if (\str_starts_with($pattern, '[/')) {
241
+        if (\str_starts_with($pattern, '[/'))
242
+        {
226 243
             $pattern = '[' . \substr($pattern, 2);
227 244
         }
228 245
 
229
-        if (\preg_match_all('/<(\w+):?(.*?)?>/', $pattern, $matches)) {
246
+        if (\preg_match_all('/<(\w+):?(.*?)?>/', $pattern, $matches))
247
+        {
230 248
             $variables = \array_combine($matches[1], $matches[2]);
231 249
 
232
-            foreach ($variables as $key => $segment) {
250
+            foreach ($variables as $key => $segment)
251
+            {
233 252
                 $segment = $this->prepareSegment($key, $segment);
234 253
                 $replaces[\sprintf('<%s>', $key)] = \sprintf('(?P<%s>%s)', $key, $segment);
235 254
                 $options[] = $key;
@@ -239,13 +258,16 @@  discard block
 block discarded – undo
239 258
         $template = \preg_replace('/<(\w+):?.*?>/', '<\1>', $pattern);
240 259
         $options = \array_fill_keys($options, null);
241 260
 
242
-        foreach ($this->constrains as $key => $value) {
243
-            if ($value instanceof Autofill) {
261
+        foreach ($this->constrains as $key => $value)
262
+        {
263
+            if ($value instanceof Autofill)
264
+            {
244 265
                 // only forces value replacement, not required to be presented as parameter
245 266
                 continue;
246 267
             }
247 268
 
248
-            if (!\array_key_exists($key, $options) && !isset($this->defaults[$key])) {
269
+            if (!\array_key_exists($key, $options) && !isset($this->defaults[$key]))
270
+            {
249 271
                 throw new ConstrainException(
250 272
                     \sprintf(
251 273
                         'Route `%s` does not define routing parameter `<%s>`.',
@@ -267,7 +289,8 @@  discard block
 block discarded – undo
267 289
     private function interpolate(string $string, array $values): string
268 290
     {
269 291
         $replaces = [];
270
-        foreach ($values as $key => $value) {
292
+        foreach ($values as $key => $value)
293
+        {
271 294
             $replaces[\sprintf('<%s>', $key)] = match (true) {
272 295
                 $value instanceof \Stringable || \is_scalar($value) => (string) $value,
273 296
                 default => '',
Please login to merge, or discard this patch.
src/Router/src/Target/Controller.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
         private readonly string $controller,
16 16
         int $options = 0,
17 17
         string $defaultAction = 'index'
18
-    ) {
18
+    ){
19 19
         parent::__construct(
20 20
             ['action' => null],
21 21
             ['action' => null],
Please login to merge, or discard this patch.
src/Router/src/Target/Group.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
         private readonly array $controllers,
16 16
         int $options = 0,
17 17
         string $defaultAction = 'index'
18
-    ) {
18
+    ){
19 19
         parent::__construct(
20 20
             ['controller' => null, 'action' => null],
21 21
             ['controller' => \array_keys($controllers), 'action' => null],
Please login to merge, or discard this patch.
src/Router/src/Target/Namespaced.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
         string $namespace,
24 24
         string $postfix = 'Controller',
25 25
         int $options = 0
26
-    ) {
26
+    ){
27 27
         $this->namespace = \rtrim($namespace, '\\');
28 28
         $this->postfix = \ucfirst($postfix);
29 29
 
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 
39 39
     protected function resolveController(array $matches): string
40 40
     {
41
-        if (\preg_match('/[^a-z_0-9\-]/i', $matches['controller'])) {
41
+        if (\preg_match('/[^a-z_0-9\-]/i', $matches['controller'])){
42 42
             throw new TargetException('Invalid namespace target, controller name not allowed.');
43 43
         }
44 44
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,8 @@
 block discarded – undo
38 38
 
39 39
     protected function resolveController(array $matches): string
40 40
     {
41
-        if (\preg_match('/[^a-z_0-9\-]/i', $matches['controller'])) {
41
+        if (\preg_match('/[^a-z_0-9\-]/i', $matches['controller']))
42
+        {
42 43
             throw new TargetException('Invalid namespace target, controller name not allowed.');
43 44
         }
44 45
 
Please login to merge, or discard this patch.
src/Router/src/Target/Action.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -23,16 +23,16 @@  discard block
 block discarded – undo
23 23
      */
24 24
     public function __construct(
25 25
         private readonly string $controller,
26
-        private readonly string|array $action,
26
+        private readonly string | array $action,
27 27
         int $options = 0
28
-    ) {
29
-        if (\is_string($action)) {
28
+    ){
29
+        if (\is_string($action)){
30 30
             parent::__construct(
31 31
                 ['action' => $action],
32 32
                 ['action' => new Autofill($action)],
33 33
                 $options
34 34
             );
35
-        } else {
35
+        }else{
36 36
             parent::__construct(
37 37
                 ['action' => null],
38 38
                 ['action' => $action],
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
     protected function resolveAction(array $matches): string
50 50
     {
51 51
         $action = $this->action;
52
-        if (\is_string($action)) {
52
+        if (\is_string($action)){
53 53
             return $action;
54 54
         }
55 55
 
Please login to merge, or discard this patch.
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -26,13 +26,16 @@  discard block
 block discarded – undo
26 26
         private readonly string|array $action,
27 27
         int $options = 0
28 28
     ) {
29
-        if (\is_string($action)) {
29
+        if (\is_string($action))
30
+        {
30 31
             parent::__construct(
31 32
                 ['action' => $action],
32 33
                 ['action' => new Autofill($action)],
33 34
                 $options
34 35
             );
35
-        } else {
36
+        }
37
+        else
38
+        {
36 39
             parent::__construct(
37 40
                 ['action' => null],
38 41
                 ['action' => $action],
@@ -49,7 +52,8 @@  discard block
 block discarded – undo
49 52
     protected function resolveAction(array $matches): string
50 53
     {
51 54
         $action = $this->action;
52
-        if (\is_string($action)) {
55
+        if (\is_string($action))
56
+        {
53 57
             return $action;
54 58
         }
55 59
 
Please login to merge, or discard this patch.
src/Router/src/CoreHandler.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
         private readonly CoreInterface $core,
34 34
         private readonly ScopeInterface $scope,
35 35
         private readonly ResponseFactoryInterface $responseFactory
36
-    ) {
36
+    ){
37 37
     }
38 38
 
39 39
     public function withContext(string $controller, string $action, array $parameters): CoreHandler
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
      */
64 64
     public function handle(Request $request): Response
65 65
     {
66
-        if ($this->controller === null) {
66
+        if ($this->controller === null){
67 67
             throw new HandlerException('Controller and action pair is not set');
68 68
         }
69 69
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
         $output = $result = null;
74 74
 
75 75
         $response = $this->responseFactory->createResponse(200);
76
-        try {
76
+        try{
77 77
             // run the core withing PSR-7 Request/Response scope
78 78
             $result = $this->scope->runScope(
79 79
                 [
@@ -86,29 +86,29 @@  discard block
 block discarded – undo
86 86
                     $this->parameters
87 87
                 )
88 88
             );
89
-        } catch (ControllerException $e) {
89
+        }catch (ControllerException $e){
90 90
             \ob_get_clean();
91 91
             throw $this->mapException($e);
92
-        } catch (\Throwable $e) {
92
+        }catch (\Throwable $e){
93 93
             \ob_get_clean();
94 94
             throw $e;
95
-        } finally {
96
-            while (\ob_get_level() > $outputLevel + 1) {
97
-                $output = \ob_get_clean() . $output;
95
+        }finally{
96
+            while (\ob_get_level() > $outputLevel + 1){
97
+                $output = \ob_get_clean().$output;
98 98
             }
99 99
         }
100 100
 
101 101
         return $this->wrapResponse(
102 102
             $response,
103 103
             $result,
104
-            \ob_get_clean() . $output
104
+            \ob_get_clean().$output
105 105
         );
106 106
     }
107 107
 
108 108
     private function getAction(Request $request): string
109 109
     {
110
-        if ($this->verbActions) {
111
-            return \strtolower($request->getMethod()) . \ucfirst($this->action);
110
+        if ($this->verbActions){
111
+            return \strtolower($request->getMethod()).\ucfirst($this->action);
112 112
         }
113 113
 
114 114
         return $this->action;
@@ -123,21 +123,21 @@  discard block
 block discarded – undo
123 123
      */
124 124
     private function wrapResponse(Response $response, mixed $result = null, string $output = ''): Response
125 125
     {
126
-        if ($result instanceof Response) {
127
-            if ($output !== '' && $result->getBody()->isWritable()) {
126
+        if ($result instanceof Response){
127
+            if ($output !== '' && $result->getBody()->isWritable()){
128 128
                 $result->getBody()->write($output);
129 129
             }
130 130
 
131 131
             return $result;
132 132
         }
133 133
 
134
-        if ($result instanceof \Generator) {
134
+        if ($result instanceof \Generator){
135 135
             return $response->withBody(new GeneratorStream($result));
136 136
         }
137 137
 
138
-        if (\is_array($result) || $result instanceof \JsonSerializable) {
138
+        if (\is_array($result) || $result instanceof \JsonSerializable){
139 139
             $response = $this->writeJson($response, $result);
140
-        } else {
140
+        }else{
141 141
             $response->getBody()->write((string)$result);
142 142
         }
143 143
 
Please login to merge, or discard this patch.
Braces   +28 added lines, -12 removed lines patch added patch discarded remove patch
@@ -63,7 +63,8 @@  discard block
 block discarded – undo
63 63
      */
64 64
     public function handle(Request $request): Response
65 65
     {
66
-        if ($this->controller === null) {
66
+        if ($this->controller === null)
67
+        {
67 68
             throw new HandlerException('Controller and action pair is not set');
68 69
         }
69 70
 
@@ -73,7 +74,8 @@  discard block
 block discarded – undo
73 74
         $output = $result = null;
74 75
 
75 76
         $response = $this->responseFactory->createResponse(200);
76
-        try {
77
+        try
78
+        {
77 79
             // run the core withing PSR-7 Request/Response scope
78 80
             $result = $this->scope->runScope(
79 81
                 [
@@ -86,14 +88,21 @@  discard block
 block discarded – undo
86 88
                     $this->parameters
87 89
                 )
88 90
             );
89
-        } catch (ControllerException $e) {
91
+        }
92
+        catch (ControllerException $e)
93
+        {
90 94
             \ob_get_clean();
91 95
             throw $this->mapException($e);
92
-        } catch (\Throwable $e) {
96
+        }
97
+        catch (\Throwable $e)
98
+        {
93 99
             \ob_get_clean();
94 100
             throw $e;
95
-        } finally {
96
-            while (\ob_get_level() > $outputLevel + 1) {
101
+        }
102
+        finally
103
+        {
104
+            while (\ob_get_level() > $outputLevel + 1)
105
+            {
97 106
                 $output = \ob_get_clean() . $output;
98 107
             }
99 108
         }
@@ -107,7 +116,8 @@  discard block
 block discarded – undo
107 116
 
108 117
     private function getAction(Request $request): string
109 118
     {
110
-        if ($this->verbActions) {
119
+        if ($this->verbActions)
120
+        {
111 121
             return \strtolower($request->getMethod()) . \ucfirst($this->action);
112 122
         }
113 123
 
@@ -123,21 +133,27 @@  discard block
 block discarded – undo
123 133
      */
124 134
     private function wrapResponse(Response $response, mixed $result = null, string $output = ''): Response
125 135
     {
126
-        if ($result instanceof Response) {
127
-            if ($output !== '' && $result->getBody()->isWritable()) {
136
+        if ($result instanceof Response)
137
+        {
138
+            if ($output !== '' && $result->getBody()->isWritable())
139
+            {
128 140
                 $result->getBody()->write($output);
129 141
             }
130 142
 
131 143
             return $result;
132 144
         }
133 145
 
134
-        if ($result instanceof \Generator) {
146
+        if ($result instanceof \Generator)
147
+        {
135 148
             return $response->withBody(new GeneratorStream($result));
136 149
         }
137 150
 
138
-        if (\is_array($result) || $result instanceof \JsonSerializable) {
151
+        if (\is_array($result) || $result instanceof \JsonSerializable)
152
+        {
139 153
             $response = $this->writeJson($response, $result);
140
-        } else {
154
+        }
155
+        else
156
+        {
141 157
             $response->getBody()->write((string)$result);
142 158
         }
143 159
 
Please login to merge, or discard this patch.
src/Auth/src/Event/Logout.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,6 +9,6 @@
 block discarded – undo
9 9
     public function __construct(
10 10
         public readonly ?object $actor,
11 11
         public readonly ?string $transport = null
12
-    ) {
12
+    ){
13 13
     }
14 14
 }
Please login to merge, or discard this patch.
src/Auth/src/Event/Authenticated.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,6 +11,6 @@
 block discarded – undo
11 11
     public function __construct(
12 12
         public readonly TokenInterface $token,
13 13
         public readonly ?string $transport = null
14
-    ) {
14
+    ){
15 15
     }
16 16
 }
Please login to merge, or discard this patch.