@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | EnvironmentInterface $env, |
45 | 45 | FinalizerInterface $finalizer, |
46 | 46 | ContainerInterface $container |
47 | - ) { |
|
47 | + ){ |
|
48 | 48 | $this->env = $env; |
49 | 49 | $this->finalizer = $finalizer; |
50 | 50 | $this->container = $container; |
@@ -73,11 +73,11 @@ discard block |
||
73 | 73 | /** @var Console $console */ |
74 | 74 | $console = $this->container->get(Console::class); |
75 | 75 | |
76 | - try { |
|
76 | + try{ |
|
77 | 77 | $console->start($input ?? new ArgvInput(), $output); |
78 | - } catch (\Throwable $e) { |
|
78 | + }catch (\Throwable $e){ |
|
79 | 79 | $this->handleException($e, $output); |
80 | - } finally { |
|
80 | + }finally{ |
|
81 | 81 | $listener->disable(); |
82 | 82 | $this->finalizer->finalize(false); |
83 | 83 | } |
@@ -89,9 +89,9 @@ discard block |
||
89 | 89 | */ |
90 | 90 | protected function handleException(\Throwable $e, OutputInterface $output) |
91 | 91 | { |
92 | - try { |
|
92 | + try{ |
|
93 | 93 | $this->container->get(SnapshotterInterface::class)->register($e); |
94 | - } catch (\Throwable|ContainerExceptionInterface $se) { |
|
94 | + }catch (\Throwable | ContainerExceptionInterface $se){ |
|
95 | 95 | // no need to notify when unable to register an exception |
96 | 96 | } |
97 | 97 | |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | */ |
107 | 107 | private function mapVerbosity(OutputInterface $output): int |
108 | 108 | { |
109 | - if ($output->isDebug() || $output->isVeryVerbose()) { |
|
109 | + if ($output->isDebug() || $output->isVeryVerbose()){ |
|
110 | 110 | return ConsoleHandler::VERBOSITY_DEBUG; |
111 | 111 | } |
112 | 112 |
@@ -73,11 +73,16 @@ discard block |
||
73 | 73 | /** @var Console $console */ |
74 | 74 | $console = $this->container->get(Console::class); |
75 | 75 | |
76 | - try { |
|
76 | + try |
|
77 | + { |
|
77 | 78 | $console->start($input ?? new ArgvInput(), $output); |
78 | - } catch (\Throwable $e) { |
|
79 | + } |
|
80 | + catch (\Throwable $e) |
|
81 | + { |
|
79 | 82 | $this->handleException($e, $output); |
80 | - } finally { |
|
83 | + } |
|
84 | + finally |
|
85 | + { |
|
81 | 86 | $listener->disable(); |
82 | 87 | $this->finalizer->finalize(false); |
83 | 88 | } |
@@ -89,9 +94,12 @@ discard block |
||
89 | 94 | */ |
90 | 95 | protected function handleException(\Throwable $e, OutputInterface $output) |
91 | 96 | { |
92 | - try { |
|
97 | + try |
|
98 | + { |
|
93 | 99 | $this->container->get(SnapshotterInterface::class)->register($e); |
94 | - } catch (\Throwable|ContainerExceptionInterface $se) { |
|
100 | + } |
|
101 | + catch (\Throwable|ContainerExceptionInterface $se) |
|
102 | + { |
|
95 | 103 | // no need to notify when unable to register an exception |
96 | 104 | } |
97 | 105 | |
@@ -106,7 +114,8 @@ discard block |
||
106 | 114 | */ |
107 | 115 | private function mapVerbosity(OutputInterface $output): int |
108 | 116 | { |
109 | - if ($output->isDebug() || $output->isVeryVerbose()) { |
|
117 | + if ($output->isDebug() || $output->isVeryVerbose()) |
|
118 | + { |
|
110 | 119 | return ConsoleHandler::VERBOSITY_DEBUG; |
111 | 120 | } |
112 | 121 |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | |
10 | 10 | use Spiral\Debug\Dumper; |
11 | 11 | |
12 | -if (!function_exists('bind')) { |
|
12 | +if (!function_exists('bind')){ |
|
13 | 13 | /** |
14 | 14 | * Shortcut to container Autowire definition. |
15 | 15 | * |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | } |
28 | 28 | } |
29 | 29 | |
30 | -if (!function_exists('dumprr')) { |
|
30 | +if (!function_exists('dumprr')){ |
|
31 | 31 | /** |
32 | 32 | * Dumprr is similar to Dump function but always redirect output to STDERR. |
33 | 33 | * |
@@ -9,7 +9,8 @@ discard block |
||
9 | 9 | |
10 | 10 | use Spiral\Debug\Dumper; |
11 | 11 | |
12 | -if (!function_exists('bind')) { |
|
12 | +if (!function_exists('bind')) |
|
13 | +{ |
|
13 | 14 | /** |
14 | 15 | * Shortcut to container Autowire definition. |
15 | 16 | * |
@@ -27,7 +28,8 @@ discard block |
||
27 | 28 | } |
28 | 29 | } |
29 | 30 | |
30 | -if (!function_exists('dumprr')) { |
|
31 | +if (!function_exists('dumprr')) |
|
32 | +{ |
|
31 | 33 | /** |
32 | 34 | * Dumprr is similar to Dump function but always redirect output to STDERR. |
33 | 35 | * |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | SchemaBootloader $bootloader, |
32 | 32 | Registry $registry, |
33 | 33 | MemoryInterface $memory |
34 | - ) { |
|
34 | + ){ |
|
35 | 35 | $show = new ShowChanges($this->output); |
36 | 36 | |
37 | 37 | $schema = (new Compiler())->compile( |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | |
42 | 42 | $memory->saveData('cycle', $schema); |
43 | 43 | |
44 | - if ($show->hasChanges()) { |
|
44 | + if ($show->hasChanges()){ |
|
45 | 45 | $this->writeln("\n<info>ORM Schema has been synchronized</info>"); |
46 | 46 | } |
47 | 47 |
@@ -41,7 +41,8 @@ |
||
41 | 41 | |
42 | 42 | $memory->saveData('cycle', $schema); |
43 | 43 | |
44 | - if ($show->hasChanges()) { |
|
44 | + if ($show->hasChanges()) |
|
45 | + { |
|
45 | 46 | $this->writeln("\n<info>ORM Schema has been synchronized</info>"); |
46 | 47 | } |
47 | 48 |
@@ -26,7 +26,7 @@ |
||
26 | 26 | string $clientFilename = null, |
27 | 27 | string $clientMediaType = null |
28 | 28 | ): UploadedFileInterface { |
29 | - if ($size === null) { |
|
29 | + if ($size === null){ |
|
30 | 30 | $size = $stream->getSize(); |
31 | 31 | } |
32 | 32 |
@@ -26,7 +26,8 @@ |
||
26 | 26 | string $clientFilename = null, |
27 | 27 | string $clientMediaType = null |
28 | 28 | ): UploadedFileInterface { |
29 | - if ($size === null) { |
|
29 | + if ($size === null) |
|
30 | + { |
|
30 | 31 | $size = $stream->getSize(); |
31 | 32 | } |
32 | 33 |
@@ -30,7 +30,8 @@ |
||
30 | 30 | |
31 | 31 | $app->getContainer()->runScope([ |
32 | 32 | TranslatorInterface::class => $app->get(Translator::class)->withLocale('ru') |
33 | - ], function () use ($app) { |
|
33 | + ], function () use ($app) |
|
34 | + { |
|
34 | 35 | $out = $app->get(ViewsInterface::class)->render('custom:locale'); |
35 | 36 | $this->assertSame('Hello Мир!', $out); |
36 | 37 | }); |
@@ -57,12 +57,12 @@ discard block |
||
57 | 57 | $http = $this->container->get(Http::class); |
58 | 58 | $emitter = $emitter ?? $this->container->get(EmitterInterface::class); |
59 | 59 | |
60 | - try { |
|
60 | + try{ |
|
61 | 61 | $response = $http->handle($this->initRequest()); |
62 | 62 | $emitter->emit($response); |
63 | - } catch (\Throwable $e) { |
|
63 | + }catch (\Throwable $e){ |
|
64 | 64 | $this->handleException($emitter, $e); |
65 | - } finally { |
|
65 | + }finally{ |
|
66 | 66 | $this->finalizer->finalize(false); |
67 | 67 | } |
68 | 68 | } |
@@ -83,10 +83,10 @@ discard block |
||
83 | 83 | { |
84 | 84 | $handler = new HtmlHandler(HtmlHandler::INVERTED); |
85 | 85 | |
86 | - try { |
|
86 | + try{ |
|
87 | 87 | /** @var SnapshotInterface $snapshot */ |
88 | 88 | $this->container->get(SnapshotterInterface::class)->register($e); |
89 | - } catch (\Throwable|ContainerExceptionInterface $se) { |
|
89 | + }catch (\Throwable | ContainerExceptionInterface $se){ |
|
90 | 90 | // nothing to report |
91 | 91 | } |
92 | 92 |
@@ -57,12 +57,17 @@ discard block |
||
57 | 57 | $http = $this->container->get(Http::class); |
58 | 58 | $emitter = $emitter ?? $this->container->get(EmitterInterface::class); |
59 | 59 | |
60 | - try { |
|
60 | + try |
|
61 | + { |
|
61 | 62 | $response = $http->handle($this->initRequest()); |
62 | 63 | $emitter->emit($response); |
63 | - } catch (\Throwable $e) { |
|
64 | + } |
|
65 | + catch (\Throwable $e) |
|
66 | + { |
|
64 | 67 | $this->handleException($emitter, $e); |
65 | - } finally { |
|
68 | + } |
|
69 | + finally |
|
70 | + { |
|
66 | 71 | $this->finalizer->finalize(false); |
67 | 72 | } |
68 | 73 | } |
@@ -83,10 +88,13 @@ discard block |
||
83 | 88 | { |
84 | 89 | $handler = new HtmlHandler(HtmlHandler::INVERTED); |
85 | 90 | |
86 | - try { |
|
91 | + try |
|
92 | + { |
|
87 | 93 | /** @var SnapshotInterface $snapshot */ |
88 | 94 | $this->container->get(SnapshotterInterface::class)->register($e); |
89 | - } catch (\Throwable|ContainerExceptionInterface $se) { |
|
95 | + } |
|
96 | + catch (\Throwable|ContainerExceptionInterface $se) |
|
97 | + { |
|
90 | 98 | // nothing to report |
91 | 99 | } |
92 | 100 |
@@ -37,7 +37,7 @@ |
||
37 | 37 | $response = new Response('php://memory', $code, []); |
38 | 38 | $response = $response->withStatus($code, $reasonPhrase); |
39 | 39 | |
40 | - foreach ($this->config->getBaseHeaders() as $header => $value) { |
|
40 | + foreach ($this->config->getBaseHeaders() as $header => $value){ |
|
41 | 41 | $response = $response->withAddedHeader($header, $value); |
42 | 42 | } |
43 | 43 |
@@ -37,7 +37,8 @@ |
||
37 | 37 | $response = new Response('php://memory', $code, []); |
38 | 38 | $response = $response->withStatus($code, $reasonPhrase); |
39 | 39 | |
40 | - foreach ($this->config->getBaseHeaders() as $header => $value) { |
|
40 | + foreach ($this->config->getBaseHeaders() as $header => $value) |
|
41 | + { |
|
41 | 42 | $response = $response->withAddedHeader($header, $value); |
42 | 43 | } |
43 | 44 |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | FinalizerInterface $finalizer, |
47 | 47 | ContainerInterface $container, |
48 | 48 | FactoryInterface $factory |
49 | - ) { |
|
49 | + ){ |
|
50 | 50 | $this->env = $env; |
51 | 51 | $this->finalizer = $finalizer; |
52 | 52 | $this->container = $container; |
@@ -70,12 +70,12 @@ discard block |
||
70 | 70 | |
71 | 71 | /** @var Http $http */ |
72 | 72 | $http = $this->container->get(Http::class); |
73 | - while ($request = $client->acceptRequest()) { |
|
74 | - try { |
|
73 | + while ($request = $client->acceptRequest()){ |
|
74 | + try{ |
|
75 | 75 | $client->respond($http->handle($request)); |
76 | - } catch (\Throwable $e) { |
|
76 | + }catch (\Throwable $e){ |
|
77 | 77 | $this->handleException($client, $e); |
78 | - } finally { |
|
78 | + }finally{ |
|
79 | 79 | $this->finalizer->finalize(false); |
80 | 80 | } |
81 | 81 | } |
@@ -89,11 +89,11 @@ discard block |
||
89 | 89 | { |
90 | 90 | $handler = new HtmlHandler(HtmlHandler::INVERTED); |
91 | 91 | |
92 | - try { |
|
92 | + try{ |
|
93 | 93 | /** @var SnapshotInterface $snapshot */ |
94 | 94 | $snapshot = $this->container->get(SnapshotterInterface::class)->register($e); |
95 | 95 | error_log($snapshot->getMessage()); |
96 | - } catch (\Throwable|ContainerExceptionInterface $se) { |
|
96 | + }catch (\Throwable | ContainerExceptionInterface $se){ |
|
97 | 97 | error_log((string)$e); |
98 | 98 | } |
99 | 99 |
@@ -70,12 +70,18 @@ discard block |
||
70 | 70 | |
71 | 71 | /** @var Http $http */ |
72 | 72 | $http = $this->container->get(Http::class); |
73 | - while ($request = $client->acceptRequest()) { |
|
74 | - try { |
|
73 | + while ($request = $client->acceptRequest()) |
|
74 | + { |
|
75 | + try |
|
76 | + { |
|
75 | 77 | $client->respond($http->handle($request)); |
76 | - } catch (\Throwable $e) { |
|
78 | + } |
|
79 | + catch (\Throwable $e) |
|
80 | + { |
|
77 | 81 | $this->handleException($client, $e); |
78 | - } finally { |
|
82 | + } |
|
83 | + finally |
|
84 | + { |
|
79 | 85 | $this->finalizer->finalize(false); |
80 | 86 | } |
81 | 87 | } |
@@ -89,11 +95,14 @@ discard block |
||
89 | 95 | { |
90 | 96 | $handler = new HtmlHandler(HtmlHandler::INVERTED); |
91 | 97 | |
92 | - try { |
|
98 | + try |
|
99 | + { |
|
93 | 100 | /** @var SnapshotInterface $snapshot */ |
94 | 101 | $snapshot = $this->container->get(SnapshotterInterface::class)->register($e); |
95 | 102 | error_log($snapshot->getMessage()); |
96 | - } catch (\Throwable|ContainerExceptionInterface $se) { |
|
103 | + } |
|
104 | + catch (\Throwable|ContainerExceptionInterface $se) |
|
105 | + { |
|
97 | 106 | error_log((string)$e); |
98 | 107 | } |
99 | 108 |
@@ -50,13 +50,13 @@ |
||
50 | 50 | CookiesBootloader $cookies, |
51 | 51 | HttpBootloader $http, |
52 | 52 | DirectoriesInterface $directories |
53 | - ) { |
|
53 | + ){ |
|
54 | 54 | $config->setDefaults('session', [ |
55 | 55 | 'lifetime' => 86400, |
56 | 56 | 'cookie' => 'sid', |
57 | 57 | 'secure' => false, |
58 | 58 | 'handler' => new Autowire(FileHandler::class, [ |
59 | - 'directory' => $directories->get('runtime') . 'session', |
|
59 | + 'directory' => $directories->get('runtime').'session', |
|
60 | 60 | 'lifetime' => 86400 |
61 | 61 | ] |
62 | 62 | ) |