Passed
Push — master ( 77392d...e0a3bd )
by Kirill
08:16 queued 11s
created
src/Framework/Command/Database/ListCommand.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -34,13 +34,13 @@  discard block
 block discarded – undo
34 34
      */
35 35
     public function perform(DatabaseConfig $config, DatabaseManager $dbal): void
36 36
     {
37
-        if ($this->argument('db')) {
37
+        if ($this->argument('db')){
38 38
             $databases = [$this->argument('db')];
39
-        } else {
39
+        }else{
40 40
             $databases = array_keys($config->getDatabases());
41 41
         }
42 42
 
43
-        if (empty($databases)) {
43
+        if (empty($databases)){
44 44
             $this->writeln('<fg=red>No databases found.</fg=red>');
45 45
 
46 46
             return;
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
             ]
59 59
         );
60 60
 
61
-        foreach ($databases as $database) {
61
+        foreach ($databases as $database){
62 62
             $database = $dbal->database($database);
63 63
 
64 64
             /** @var Driver $driver */
@@ -71,12 +71,12 @@  discard block
 block discarded – undo
71 71
                 $database->getPrefix() ?: '<comment>---</comment>',
72 72
             ];
73 73
 
74
-            try {
74
+            try{
75 75
                 $driver->connect();
76
-            } catch (\Exception $exception) {
76
+            }catch (\Exception $exception){
77 77
                 $this->renderException($grid, $header, $exception);
78 78
 
79
-                if ($database->getName() != end($databases)) {
79
+                if ($database->getName() != end($databases)){
80 80
                     $grid->addRow(new TableSeparator());
81 81
                 }
82 82
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 
86 86
             $header[] = '<info>connected</info>';
87 87
             $this->renderTables($grid, $header, $database);
88
-            if ($database->getName() != end($databases)) {
88
+            if ($database->getName() != end($databases)){
89 89
                 $grid->addRow(new TableSeparator());
90 90
             }
91 91
         }
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
      */
120 120
     private function renderTables(Table $grid, array $header, Database $database): void
121 121
     {
122
-        foreach ($database->getTables() as $table) {
122
+        foreach ($database->getTables() as $table){
123 123
             $grid->addRow(
124 124
                 array_merge(
125 125
                     $header,
Please login to merge, or discard this patch.
Braces   +20 added lines, -9 removed lines patch added patch discarded remove patch
@@ -34,13 +34,17 @@  discard block
 block discarded – undo
34 34
      */
35 35
     public function perform(DatabaseConfig $config, DatabaseManager $dbal): void
36 36
     {
37
-        if ($this->argument('db')) {
37
+        if ($this->argument('db'))
38
+        {
38 39
             $databases = [$this->argument('db')];
39
-        } else {
40
+        }
41
+        else
42
+        {
40 43
             $databases = array_keys($config->getDatabases());
41 44
         }
42 45
 
43
-        if (empty($databases)) {
46
+        if (empty($databases))
47
+        {
44 48
             $this->writeln('<fg=red>No databases found.</fg=red>');
45 49
 
46 50
             return;
@@ -58,7 +62,8 @@  discard block
 block discarded – undo
58 62
             ]
59 63
         );
60 64
 
61
-        foreach ($databases as $database) {
65
+        foreach ($databases as $database)
66
+        {
62 67
             $database = $dbal->database($database);
63 68
 
64 69
             /** @var Driver $driver */
@@ -71,12 +76,16 @@  discard block
 block discarded – undo
71 76
                 $database->getPrefix() ?: '<comment>---</comment>',
72 77
             ];
73 78
 
74
-            try {
79
+            try
80
+            {
75 81
                 $driver->connect();
76
-            } catch (\Exception $exception) {
82
+            }
83
+            catch (\Exception $exception)
84
+            {
77 85
                 $this->renderException($grid, $header, $exception);
78 86
 
79
-                if ($database->getName() != end($databases)) {
87
+                if ($database->getName() != end($databases))
88
+                {
80 89
                     $grid->addRow(new TableSeparator());
81 90
                 }
82 91
 
@@ -85,7 +94,8 @@  discard block
 block discarded – undo
85 94
 
86 95
             $header[] = '<info>connected</info>';
87 96
             $this->renderTables($grid, $header, $database);
88
-            if ($database->getName() != end($databases)) {
97
+            if ($database->getName() != end($databases))
98
+            {
89 99
                 $grid->addRow(new TableSeparator());
90 100
             }
91 101
         }
@@ -119,7 +129,8 @@  discard block
 block discarded – undo
119 129
      */
120 130
     private function renderTables(Table $grid, array $header, Database $database): void
121 131
     {
122
-        foreach ($database->getTables() as $table) {
132
+        foreach ($database->getTables() as $table)
133
+        {
123 134
             $grid->addRow(
124 135
                 array_merge(
125 136
                     $header,
Please login to merge, or discard this patch.
src/Streams/src/StreamWrapper.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
      */
73 73
     public function stream_open($path, $mode, $options, &$opened_path)
74 74
     {
75
-        if (!isset(self::$uris[$path])) {
75
+        if (!isset(self::$uris[$path])){
76 76
             return false;
77 77
         }
78 78
 
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
      */
157 157
     public function url_stat($path, $flags)
158 158
     {
159
-        if (!isset(self::$uris[$path])) {
159
+        if (!isset(self::$uris[$path])){
160 160
             return null;
161 161
         }
162 162
 
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
      */
169 169
     public static function register()
170 170
     {
171
-        if (self::$registered) {
171
+        if (self::$registered){
172 172
             return;
173 173
         }
174 174
 
@@ -184,8 +184,8 @@  discard block
 block discarded – undo
184 184
      */
185 185
     public static function has($file)
186 186
     {
187
-        if ($file instanceof StreamInterface) {
188
-            $file = 'spiral://' . spl_object_hash($file);
187
+        if ($file instanceof StreamInterface){
188
+            $file = 'spiral://'.spl_object_hash($file);
189 189
         }
190 190
 
191 191
         return isset(self::$uris[$file]);
@@ -202,15 +202,15 @@  discard block
 block discarded – undo
202 202
     public static function getResource(StreamInterface $stream)
203 203
     {
204 204
         $mode = null;
205
-        if ($stream->isReadable()) {
205
+        if ($stream->isReadable()){
206 206
             $mode = 'r';
207 207
         }
208 208
 
209
-        if ($stream->isWritable()) {
209
+        if ($stream->isWritable()){
210 210
             $mode = !empty($mode) ? 'r+' : 'w';
211 211
         }
212 212
 
213
-        if (empty($mode)) {
213
+        if (empty($mode)){
214 214
             throw new WrapperException('Stream is not available in read or write modes');
215 215
         }
216 216
 
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
     {
228 228
         self::register();
229 229
 
230
-        $uri = 'spiral://' . spl_object_hash($stream);
230
+        $uri = 'spiral://'.spl_object_hash($stream);
231 231
         self::$uris[$uri] = $stream;
232 232
 
233 233
         return $uri;
@@ -241,8 +241,8 @@  discard block
 block discarded – undo
241 241
      */
242 242
     public static function release($file)
243 243
     {
244
-        if ($file instanceof StreamInterface) {
245
-            $file = 'spiral://' . spl_object_hash($file);
244
+        if ($file instanceof StreamInterface){
245
+            $file = 'spiral://'.spl_object_hash($file);
246 246
         }
247 247
 
248 248
         unset(self::$uris[$file]);
@@ -257,12 +257,12 @@  discard block
 block discarded – undo
257 257
     private function getStreamStats(StreamInterface $stream)
258 258
     {
259 259
         $mode = $this->mode;
260
-        if (empty($mode)) {
261
-            if ($stream->isReadable()) {
260
+        if (empty($mode)){
261
+            if ($stream->isReadable()){
262 262
                 $mode = 'r';
263 263
             }
264 264
 
265
-            if ($stream->isWritable()) {
265
+            if ($stream->isWritable()){
266 266
                 $mode = !empty($mode) ? 'r+' : 'w';
267 267
             }
268 268
         }
Please login to merge, or discard this patch.
Braces   +22 added lines, -11 removed lines patch added patch discarded remove patch
@@ -72,7 +72,8 @@  discard block
 block discarded – undo
72 72
      */
73 73
     public function stream_open($path, $mode, $options, &$opened_path)
74 74
     {
75
-        if (!isset(self::$uris[$path])) {
75
+        if (!isset(self::$uris[$path]))
76
+        {
76 77
             return false;
77 78
         }
78 79
 
@@ -156,7 +157,8 @@  discard block
 block discarded – undo
156 157
      */
157 158
     public function url_stat($path, $flags)
158 159
     {
159
-        if (!isset(self::$uris[$path])) {
160
+        if (!isset(self::$uris[$path]))
161
+        {
160 162
             return null;
161 163
         }
162 164
 
@@ -168,7 +170,8 @@  discard block
 block discarded – undo
168 170
      */
169 171
     public static function register()
170 172
     {
171
-        if (self::$registered) {
173
+        if (self::$registered)
174
+        {
172 175
             return;
173 176
         }
174 177
 
@@ -184,7 +187,8 @@  discard block
 block discarded – undo
184 187
      */
185 188
     public static function has($file)
186 189
     {
187
-        if ($file instanceof StreamInterface) {
190
+        if ($file instanceof StreamInterface)
191
+        {
188 192
             $file = 'spiral://' . spl_object_hash($file);
189 193
         }
190 194
 
@@ -202,15 +206,18 @@  discard block
 block discarded – undo
202 206
     public static function getResource(StreamInterface $stream)
203 207
     {
204 208
         $mode = null;
205
-        if ($stream->isReadable()) {
209
+        if ($stream->isReadable())
210
+        {
206 211
             $mode = 'r';
207 212
         }
208 213
 
209
-        if ($stream->isWritable()) {
214
+        if ($stream->isWritable())
215
+        {
210 216
             $mode = !empty($mode) ? 'r+' : 'w';
211 217
         }
212 218
 
213
-        if (empty($mode)) {
219
+        if (empty($mode))
220
+        {
214 221
             throw new WrapperException('Stream is not available in read or write modes');
215 222
         }
216 223
 
@@ -241,7 +248,8 @@  discard block
 block discarded – undo
241 248
      */
242 249
     public static function release($file)
243 250
     {
244
-        if ($file instanceof StreamInterface) {
251
+        if ($file instanceof StreamInterface)
252
+        {
245 253
             $file = 'spiral://' . spl_object_hash($file);
246 254
         }
247 255
 
@@ -257,12 +265,15 @@  discard block
 block discarded – undo
257 265
     private function getStreamStats(StreamInterface $stream)
258 266
     {
259 267
         $mode = $this->mode;
260
-        if (empty($mode)) {
261
-            if ($stream->isReadable()) {
268
+        if (empty($mode))
269
+        {
270
+            if ($stream->isReadable())
271
+            {
262 272
                 $mode = 'r';
263 273
             }
264 274
 
265
-            if ($stream->isWritable()) {
275
+            if ($stream->isWritable())
276
+            {
266 277
                 $mode = !empty($mode) ? 'r+' : 'w';
267 278
             }
268 279
         }
Please login to merge, or discard this patch.
src/Exceptions/src/JsonHandler.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -39,24 +39,24 @@
 block discarded – undo
39 39
      */
40 40
     private function renderTrace(array $trace, int $verbosity): \Generator
41 41
     {
42
-        foreach ($trace as $item) {
42
+        foreach ($trace as $item){
43 43
             $result = [];
44 44
 
45
-            if (isset($item['class'])) {
45
+            if (isset($item['class'])){
46 46
                 $result['function'] = sprintf(
47 47
                     '%s%s%s()',
48 48
                     $item['class'],
49 49
                     $item['type'],
50 50
                     $item['function']
51 51
                 );
52
-            } else {
52
+            }else{
53 53
                 $result['function'] = sprintf(
54 54
                     '%s()',
55 55
                     $item['function']
56 56
                 );
57 57
             }
58 58
 
59
-            if ($verbosity >= self::VERBOSITY_VERBOSE && isset($item['file'])) {
59
+            if ($verbosity >= self::VERBOSITY_VERBOSE && isset($item['file'])){
60 60
                 $result['at'] = [
61 61
                     'file' => $item['file'] ?? null,
62 62
                     'line' => $item['line'] ?? null,
Please login to merge, or discard this patch.
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -39,24 +39,29 @@
 block discarded – undo
39 39
      */
40 40
     private function renderTrace(array $trace, int $verbosity): \Generator
41 41
     {
42
-        foreach ($trace as $item) {
42
+        foreach ($trace as $item)
43
+        {
43 44
             $result = [];
44 45
 
45
-            if (isset($item['class'])) {
46
+            if (isset($item['class']))
47
+            {
46 48
                 $result['function'] = sprintf(
47 49
                     '%s%s%s()',
48 50
                     $item['class'],
49 51
                     $item['type'],
50 52
                     $item['function']
51 53
                 );
52
-            } else {
54
+            }
55
+            else
56
+            {
53 57
                 $result['function'] = sprintf(
54 58
                     '%s()',
55 59
                     $item['function']
56 60
                 );
57 61
             }
58 62
 
59
-            if ($verbosity >= self::VERBOSITY_VERBOSE && isset($item['file'])) {
63
+            if ($verbosity >= self::VERBOSITY_VERBOSE && isset($item['file']))
64
+            {
60 65
                 $result['at'] = [
61 66
                     'file' => $item['file'] ?? null,
62 67
                     'line' => $item['line'] ?? null,
Please login to merge, or discard this patch.
src/Exceptions/src/AbstractHandler.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
     protected function getStacktrace(\Throwable $e): array
34 34
     {
35 35
         $stacktrace = $e->getTrace();
36
-        if (empty($stacktrace)) {
36
+        if (empty($stacktrace)){
37 37
             return [];
38 38
         }
39 39
 
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
                 'line' => $e->getLine(),
44 44
             ] + $stacktrace[0];
45 45
 
46
-        if ($stacktrace[0] != $header) {
46
+        if ($stacktrace[0] != $header){
47 47
             array_unshift($stacktrace, $header);
48 48
         }
49 49
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,8 @@  discard block
 block discarded – undo
33 33
     protected function getStacktrace(\Throwable $e): array
34 34
     {
35 35
         $stacktrace = $e->getTrace();
36
-        if (empty($stacktrace)) {
36
+        if (empty($stacktrace))
37
+        {
37 38
             return [];
38 39
         }
39 40
 
@@ -43,7 +44,8 @@  discard block
 block discarded – undo
43 44
                 'line' => $e->getLine(),
44 45
             ] + $stacktrace[0];
45 46
 
46
-        if ($stacktrace[0] != $header) {
47
+        if ($stacktrace[0] != $header)
48
+        {
47 49
             array_unshift($stacktrace, $header);
48 50
         }
49 51
 
Please login to merge, or discard this patch.
src/Console/src/Sequence/CallableSequence.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
         array $parameters = [],
38 38
         string $header = '',
39 39
         string $footer = ''
40
-    ) {
40
+    ){
41 41
         $this->function = $function;
42 42
         $this->parameters = $parameters;
43 43
 
@@ -50,18 +50,18 @@  discard block
 block discarded – undo
50 50
     public function execute(ContainerInterface $container, OutputInterface $output): void
51 51
     {
52 52
         $function = $this->function;
53
-        if (is_string($function) && strpos($function, ':') !== false) {
53
+        if (is_string($function) && strpos($function, ':') !== false){
54 54
             $function = explode(':', str_replace('::', ':', $function));
55 55
         }
56 56
 
57
-        if (is_array($function) && isset($function[0]) && !is_object($function[0])) {
57
+        if (is_array($function) && isset($function[0]) && !is_object($function[0])){
58 58
             $function[0] = $container->get($function[0]);
59 59
         }
60 60
 
61 61
         /** @var ResolverInterface $resolver */
62 62
         $resolver = $container->get(ResolverInterface::class);
63 63
 
64
-        if (is_array($function)) {
64
+        if (is_array($function)){
65 65
             $reflection = new \ReflectionMethod($function[0], $function[1]);
66 66
             $reflection->invokeArgs($function[0], $resolver->resolveArguments($reflection, [
67 67
                 'output' => $output,
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -50,18 +50,21 @@
 block discarded – undo
50 50
     public function execute(ContainerInterface $container, OutputInterface $output): void
51 51
     {
52 52
         $function = $this->function;
53
-        if (is_string($function) && strpos($function, ':') !== false) {
53
+        if (is_string($function) && strpos($function, ':') !== false)
54
+        {
54 55
             $function = explode(':', str_replace('::', ':', $function));
55 56
         }
56 57
 
57
-        if (is_array($function) && isset($function[0]) && !is_object($function[0])) {
58
+        if (is_array($function) && isset($function[0]) && !is_object($function[0]))
59
+        {
58 60
             $function[0] = $container->get($function[0]);
59 61
         }
60 62
 
61 63
         /** @var ResolverInterface $resolver */
62 64
         $resolver = $container->get(ResolverInterface::class);
63 65
 
64
-        if (is_array($function)) {
66
+        if (is_array($function))
67
+        {
65 68
             $reflection = new \ReflectionMethod($function[0], $function[1]);
66 69
             $reflection->invokeArgs($function[0], $resolver->resolveArguments($reflection, [
67 70
                 'output' => $output,
Please login to merge, or discard this patch.
src/Dumper/src/helpers.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 
12 12
 use Spiral\Debug\Dumper;
13 13
 
14
-if (!function_exists('dump')) {
14
+if (!function_exists('dump')){
15 15
     /**
16 16
      * Dump value.
17 17
      *
@@ -22,12 +22,12 @@  discard block
 block discarded – undo
22 22
      */
23 23
     function dump($value, int $output = Dumper::OUTPUT): ?string
24 24
     {
25
-        if (!class_exists(\Spiral\Core\ContainerScope::class)) {
25
+        if (!class_exists(\Spiral\Core\ContainerScope::class)){
26 26
             return (new Dumper())->dump($value, $output);
27 27
         }
28 28
 
29 29
         $container = \Spiral\Core\ContainerScope::getContainer();
30
-        if (is_null($container) || !$container->has(Dumper::class)) {
30
+        if (is_null($container) || !$container->has(Dumper::class)){
31 31
             $dumper = new Dumper();
32 32
 
33 33
             return $dumper->dump($value, $output);
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,7 +11,8 @@  discard block
 block discarded – undo
11 11
 
12 12
 use Spiral\Debug\Dumper;
13 13
 
14
-if (!function_exists('dump')) {
14
+if (!function_exists('dump'))
15
+{
15 16
     /**
16 17
      * Dump value.
17 18
      *
@@ -22,12 +23,14 @@  discard block
 block discarded – undo
22 23
      */
23 24
     function dump($value, int $output = Dumper::OUTPUT): ?string
24 25
     {
25
-        if (!class_exists(\Spiral\Core\ContainerScope::class)) {
26
+        if (!class_exists(\Spiral\Core\ContainerScope::class))
27
+        {
26 28
             return (new Dumper())->dump($value, $output);
27 29
         }
28 30
 
29 31
         $container = \Spiral\Core\ContainerScope::getContainer();
30
-        if (is_null($container) || !$container->has(Dumper::class)) {
32
+        if (is_null($container) || !$container->has(Dumper::class))
33
+        {
31 34
             $dumper = new Dumper();
32 35
 
33 36
             return $dumper->dump($value, $output);
Please login to merge, or discard this patch.
src/Reactor/src/Traits/AccessTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
             AbstractDeclaration::ACCESS_PROTECTED,
39 39
             AbstractDeclaration::ACCESS_PUBLIC,
40 40
             ], true)
41
-        ) {
41
+        ){
42 42
             throw new ReactorException("Invalid declaration level '{$access}'");
43 43
         }
44 44
 
Please login to merge, or discard this patch.
src/Framework/Http/Middleware/ErrorHandlerMiddleware.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
         RendererInterface $renderer,
60 60
         ResponseFactoryInterface $responseFactory,
61 61
         ContainerInterface $container
62
-    ) {
62
+    ){
63 63
         $this->suppressErrors = $suppressErrors;
64 64
         $this->renderer = $renderer;
65 65
         $this->responseFactory = $responseFactory;
@@ -73,22 +73,22 @@  discard block
 block discarded – undo
73 73
      */
74 74
     public function process(Request $request, Handler $handler): Response
75 75
     {
76
-        try {
76
+        try{
77 77
             return $handler->handle($request);
78
-        } catch (ClientException | RouterException $e) {
79
-            if ($e instanceof ClientException) {
78
+        }catch (ClientException | RouterException $e){
79
+            if ($e instanceof ClientException){
80 80
                 $code = $e->getCode();
81
-            } else {
81
+            }else{
82 82
                 $code = 404;
83 83
             }
84
-        } catch (\Throwable $e) {
84
+        }catch (\Throwable $e){
85 85
             $snapshotter = $this->getOptional(SnapshotterInterface::class);
86
-            if ($snapshotter !== null) {
86
+            if ($snapshotter !== null){
87 87
                 /** @var SnapshotterInterface $snapshotter */
88 88
                 $snapshotter->register($e);
89 89
             }
90 90
 
91
-            if (!$this->suppressErrors->suppressed()) {
91
+            if (!$this->suppressErrors->suppressed()){
92 92
                 return $this->renderError($request, $e);
93 93
             }
94 94
 
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
     {
112 112
         $response = $this->responseFactory->createResponse(500);
113 113
 
114
-        if ($request->getHeaderLine('Accept') === 'application/json') {
114
+        if ($request->getHeaderLine('Accept') === 'application/json'){
115 115
             $response = $response->withHeader('Content-Type', 'application/json');
116 116
             $handler = new JsonHandler();
117 117
             $response->getBody()->write(
@@ -123,10 +123,10 @@  discard block
 block discarded – undo
123 123
                     )
124 124
                 )
125 125
             );
126
-        } else {
126
+        }else{
127 127
             $handler = new HtmlHandler();
128 128
             $state = $this->getOptional(StateInterface::class);
129
-            if ($state !== null) {
129
+            if ($state !== null){
130 130
                 $handler = $handler->withState($state);
131 131
             }
132 132
 
@@ -162,9 +162,9 @@  discard block
 block discarded – undo
162 162
      */
163 163
     private function getOptional(string $class)
164 164
     {
165
-        try {
165
+        try{
166 166
             return $this->container->get($class);
167
-        } catch (\Throwable | ContainerExceptionInterface $se) {
167
+        }catch (\Throwable | ContainerExceptionInterface $se){
168 168
             return null;
169 169
         }
170 170
     }
Please login to merge, or discard this patch.
Braces   +29 added lines, -12 removed lines patch added patch discarded remove patch
@@ -73,22 +73,32 @@  discard block
 block discarded – undo
73 73
      */
74 74
     public function process(Request $request, Handler $handler): Response
75 75
     {
76
-        try {
76
+        try
77
+        {
77 78
             return $handler->handle($request);
78
-        } catch (ClientException | RouterException $e) {
79
-            if ($e instanceof ClientException) {
79
+        }
80
+        catch (ClientException | RouterException $e)
81
+        {
82
+            if ($e instanceof ClientException)
83
+            {
80 84
                 $code = $e->getCode();
81
-            } else {
85
+            }
86
+            else
87
+            {
82 88
                 $code = 404;
83 89
             }
84
-        } catch (\Throwable $e) {
90
+        }
91
+        catch (\Throwable $e)
92
+        {
85 93
             $snapshotter = $this->getOptional(SnapshotterInterface::class);
86
-            if ($snapshotter !== null) {
94
+            if ($snapshotter !== null)
95
+            {
87 96
                 /** @var SnapshotterInterface $snapshotter */
88 97
                 $snapshotter->register($e);
89 98
             }
90 99
 
91
-            if (!$this->suppressErrors->suppressed()) {
100
+            if (!$this->suppressErrors->suppressed())
101
+            {
92 102
                 return $this->renderError($request, $e);
93 103
             }
94 104
 
@@ -111,7 +121,8 @@  discard block
 block discarded – undo
111 121
     {
112 122
         $response = $this->responseFactory->createResponse(500);
113 123
 
114
-        if ($request->getHeaderLine('Accept') === 'application/json') {
124
+        if ($request->getHeaderLine('Accept') === 'application/json')
125
+        {
115 126
             $response = $response->withHeader('Content-Type', 'application/json');
116 127
             $handler = new JsonHandler();
117 128
             $response->getBody()->write(
@@ -123,10 +134,13 @@  discard block
 block discarded – undo
123 134
                     )
124 135
                 )
125 136
             );
126
-        } else {
137
+        }
138
+        else
139
+        {
127 140
             $handler = new HtmlHandler();
128 141
             $state = $this->getOptional(StateInterface::class);
129
-            if ($state !== null) {
142
+            if ($state !== null)
143
+            {
130 144
                 $handler = $handler->withState($state);
131 145
             }
132 146
 
@@ -162,9 +176,12 @@  discard block
 block discarded – undo
162 176
      */
163 177
     private function getOptional(string $class)
164 178
     {
165
-        try {
179
+        try
180
+        {
166 181
             return $this->container->get($class);
167
-        } catch (\Throwable | ContainerExceptionInterface $se) {
182
+        }
183
+        catch (\Throwable | ContainerExceptionInterface $se)
184
+        {
168 185
             return null;
169 186
         }
170 187
     }
Please login to merge, or discard this patch.
tests/Framework/Cycle/SchemaTest.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -62,10 +62,10 @@
 block discarded – undo
62 62
     {
63 63
         $app = TestApp::init(
64 64
             [
65
-                'root'    => __DIR__ . '/../../..',
66
-                'app'     => __DIR__ . '/../../emptyApp',
67
-                'runtime' => sys_get_temp_dir() . '/spiral',
68
-                'cache'   => sys_get_temp_dir() . '/spiral',
65
+                'root'    => __DIR__.'/../../..',
66
+                'app'     => __DIR__.'/../../emptyApp',
67
+                'runtime' => sys_get_temp_dir().'/spiral',
68
+                'cache'   => sys_get_temp_dir().'/spiral',
69 69
             ],
70 70
             new Environment(['SAFE_MIGRATIONS' => true]),
71 71
             false
Please login to merge, or discard this patch.