@@ -13,8 +13,10 @@ |
||
13 | 13 | |
14 | 14 | class TestJob extends AbstractJob |
15 | 15 | { |
16 | - public function do(EnvironmentInterface $env) |
|
16 | + public function do{ |
|
17 | + (EnvironmentInterface $env) |
|
17 | 18 | { |
18 | 19 | $env->set('FIRED', true); |
19 | 20 | } |
21 | + } |
|
20 | 22 | } |
21 | 23 | \ No newline at end of file |
@@ -36,21 +36,21 @@ |
||
36 | 36 | { |
37 | 37 | $conn = $env->get('RR_RPC', static::RPC_DEFAULT); |
38 | 38 | |
39 | - if (!preg_match('#^([a-z]+)://([^:]+):?(\d+)?$#i', $conn, $parts)) { |
|
39 | + if (!preg_match('#^([a-z]+)://([^:]+):?(\d+)?$#i', $conn, $parts)){ |
|
40 | 40 | throw new BootException( |
41 | 41 | "Unable to configure RPC connection, invalid DSN given `{$conn}`." |
42 | 42 | ); |
43 | 43 | } |
44 | 44 | |
45 | - if (!in_array($parts[1], ['tcp', 'unix'])) { |
|
45 | + if (!in_array($parts[1], ['tcp', 'unix'])){ |
|
46 | 46 | throw new BootException( |
47 | 47 | "Unable to configure RPC connection, invalid DSN given `{$conn}`." |
48 | 48 | ); |
49 | 49 | } |
50 | 50 | |
51 | - if ($parts[1] == 'unix') { |
|
51 | + if ($parts[1] == 'unix'){ |
|
52 | 52 | $relay = new SocketRelay($parts[2], null, SocketRelay::SOCK_UNIX); |
53 | - } else { |
|
53 | + }else{ |
|
54 | 54 | $relay = new SocketRelay($parts[2], (int)$parts[3], SocketRelay::SOCK_TCP); |
55 | 55 | } |
56 | 56 |
@@ -36,21 +36,26 @@ |
||
36 | 36 | { |
37 | 37 | $conn = $env->get('RR_RPC', static::RPC_DEFAULT); |
38 | 38 | |
39 | - if (!preg_match('#^([a-z]+)://([^:]+):?(\d+)?$#i', $conn, $parts)) { |
|
39 | + if (!preg_match('#^([a-z]+)://([^:]+):?(\d+)?$#i', $conn, $parts)) |
|
40 | + { |
|
40 | 41 | throw new BootException( |
41 | 42 | "Unable to configure RPC connection, invalid DSN given `{$conn}`." |
42 | 43 | ); |
43 | 44 | } |
44 | 45 | |
45 | - if (!in_array($parts[1], ['tcp', 'unix'])) { |
|
46 | + if (!in_array($parts[1], ['tcp', 'unix'])) |
|
47 | + { |
|
46 | 48 | throw new BootException( |
47 | 49 | "Unable to configure RPC connection, invalid DSN given `{$conn}`." |
48 | 50 | ); |
49 | 51 | } |
50 | 52 | |
51 | - if ($parts[1] == 'unix') { |
|
53 | + if ($parts[1] == 'unix') |
|
54 | + { |
|
52 | 55 | $relay = new SocketRelay($parts[2], null, SocketRelay::SOCK_UNIX); |
53 | - } else { |
|
56 | + } |
|
57 | + else |
|
58 | + { |
|
54 | 59 | $relay = new SocketRelay($parts[2], (int)$parts[3], SocketRelay::SOCK_TCP); |
55 | 60 | } |
56 | 61 |
@@ -40,11 +40,11 @@ discard block |
||
40 | 40 | $this->output->writeln("<info>Detecting schema changes:</info>"); |
41 | 41 | |
42 | 42 | $this->changes = []; |
43 | - foreach ($registry->getIterator() as $e) { |
|
44 | - if ($registry->hasTable($e)) { |
|
43 | + foreach ($registry->getIterator() as $e){ |
|
44 | + if ($registry->hasTable($e)){ |
|
45 | 45 | $table = $registry->getTableSchema($e); |
46 | 46 | |
47 | - if ($table->getComparator()->hasChanges()) { |
|
47 | + if ($table->getComparator()->hasChanges()){ |
|
48 | 48 | $this->changes[] = [ |
49 | 49 | 'database' => $registry->getDatabase($e), |
50 | 50 | 'table' => $registry->getTable($e), |
@@ -54,13 +54,13 @@ discard block |
||
54 | 54 | } |
55 | 55 | } |
56 | 56 | |
57 | - if ($this->changes === []) { |
|
57 | + if ($this->changes === []){ |
|
58 | 58 | $this->output->writeln("<fg=yellow>no database changes has been detected</fg=yellow>"); |
59 | 59 | |
60 | 60 | return $registry; |
61 | 61 | } |
62 | 62 | |
63 | - foreach ($this->changes as $change) { |
|
63 | + foreach ($this->changes as $change){ |
|
64 | 64 | $this->output->write(sprintf("• <fg=cyan>%s.%s</fg=cyan>", $change['database'], $change['table'])); |
65 | 65 | $this->describeChanges($change['schema']); |
66 | 66 | } |
@@ -73,22 +73,22 @@ discard block |
||
73 | 73 | */ |
74 | 74 | protected function describeChanges(AbstractTable $table) |
75 | 75 | { |
76 | - if (!$this->output->isVerbose()) { |
|
76 | + if (!$this->output->isVerbose()){ |
|
77 | 77 | $this->output->writeln(sprintf( |
78 | 78 | ": <fg=green>%s</fg=green> change(s) detected", |
79 | 79 | $this->numChanges($table) |
80 | 80 | )); |
81 | 81 | |
82 | 82 | return; |
83 | - } else { |
|
83 | + }else{ |
|
84 | 84 | $this->output->write("\n"); |
85 | 85 | } |
86 | 86 | |
87 | - if (!$table->exists()) { |
|
87 | + if (!$table->exists()){ |
|
88 | 88 | $this->output->writeln(" - create table"); |
89 | 89 | } |
90 | 90 | |
91 | - if ($table->getStatus() === AbstractTable::STATUS_DECLARED_DROPPED) { |
|
91 | + if ($table->getStatus() === AbstractTable::STATUS_DECLARED_DROPPED){ |
|
92 | 92 | $this->output->writeln(" - drop table"); |
93 | 93 | return; |
94 | 94 | } |
@@ -105,15 +105,15 @@ discard block |
||
105 | 105 | */ |
106 | 106 | protected function describeColumns(Comparator $cmp) |
107 | 107 | { |
108 | - foreach ($cmp->addedColumns() as $column) { |
|
108 | + foreach ($cmp->addedColumns() as $column){ |
|
109 | 109 | $this->output->writeln(" - add column <fg=yellow>{$column->getName()}</fg=yellow>"); |
110 | 110 | } |
111 | 111 | |
112 | - foreach ($cmp->droppedColumns() as $column) { |
|
112 | + foreach ($cmp->droppedColumns() as $column){ |
|
113 | 113 | $this->output->writeln(" - drop column <fg=yellow>{$column->getName()}</fg=yellow>"); |
114 | 114 | } |
115 | 115 | |
116 | - foreach ($cmp->alteredColumns() as $column) { |
|
116 | + foreach ($cmp->alteredColumns() as $column){ |
|
117 | 117 | $column = $column[0]; |
118 | 118 | $this->output->writeln(" - alter column <fg=yellow>{$column->getName()}</fg=yellow>"); |
119 | 119 | } |
@@ -124,17 +124,17 @@ discard block |
||
124 | 124 | */ |
125 | 125 | protected function describeIndexes(Comparator $cmp) |
126 | 126 | { |
127 | - foreach ($cmp->addedIndexes() as $index) { |
|
127 | + foreach ($cmp->addedIndexes() as $index){ |
|
128 | 128 | $index = join(', ', $index->getColumns()); |
129 | 129 | $this->output->writeln(" - add index on <fg=yellow>[{$index}]</fg=yellow>"); |
130 | 130 | } |
131 | 131 | |
132 | - foreach ($cmp->droppedIndexes() as $index) { |
|
132 | + foreach ($cmp->droppedIndexes() as $index){ |
|
133 | 133 | $index = join(', ', $index->getColumns()); |
134 | 134 | $this->output->writeln(" - drop index on <fg=yellow>[{$index}]</fg=yellow>"); |
135 | 135 | } |
136 | 136 | |
137 | - foreach ($cmp->alteredIndexes() as $index) { |
|
137 | + foreach ($cmp->alteredIndexes() as $index){ |
|
138 | 138 | $index = $index[0]; |
139 | 139 | $index = join(', ', $index->getColumns()); |
140 | 140 | $this->output->writeln(" - alter index on <fg=yellow>[{$index}]</fg=yellow>"); |
@@ -146,15 +146,15 @@ discard block |
||
146 | 146 | */ |
147 | 147 | protected function describeFKs(Comparator $cmp) |
148 | 148 | { |
149 | - foreach ($cmp->addedForeignKeys() as $fk) { |
|
149 | + foreach ($cmp->addedForeignKeys() as $fk){ |
|
150 | 150 | $this->output->writeln(" - add foreign key on <fg=yellow>{$fk->getColumn()}</fg=yellow>"); |
151 | 151 | } |
152 | 152 | |
153 | - foreach ($cmp->droppedForeignKeys() as $fk) { |
|
153 | + foreach ($cmp->droppedForeignKeys() as $fk){ |
|
154 | 154 | $this->output->writeln(" - drop foreign key <fg=yellow>{$fk->getColumn()}</fg=yellow>"); |
155 | 155 | } |
156 | 156 | |
157 | - foreach ($cmp->alteredForeignKeys() as $fk) { |
|
157 | + foreach ($cmp->alteredForeignKeys() as $fk){ |
|
158 | 158 | $fk = $fk[0]; |
159 | 159 | $this->output->writeln(" - alter foreign key <fg=yellow>{$fk->getColumn()}</fg=yellow>"); |
160 | 160 | } |
@@ -40,11 +40,14 @@ discard block |
||
40 | 40 | $this->output->writeln("<info>Detecting schema changes:</info>"); |
41 | 41 | |
42 | 42 | $this->changes = []; |
43 | - foreach ($registry->getIterator() as $e) { |
|
44 | - if ($registry->hasTable($e)) { |
|
43 | + foreach ($registry->getIterator() as $e) |
|
44 | + { |
|
45 | + if ($registry->hasTable($e)) |
|
46 | + { |
|
45 | 47 | $table = $registry->getTableSchema($e); |
46 | 48 | |
47 | - if ($table->getComparator()->hasChanges()) { |
|
49 | + if ($table->getComparator()->hasChanges()) |
|
50 | + { |
|
48 | 51 | $this->changes[] = [ |
49 | 52 | 'database' => $registry->getDatabase($e), |
50 | 53 | 'table' => $registry->getTable($e), |
@@ -54,13 +57,15 @@ discard block |
||
54 | 57 | } |
55 | 58 | } |
56 | 59 | |
57 | - if ($this->changes === []) { |
|
60 | + if ($this->changes === []) |
|
61 | + { |
|
58 | 62 | $this->output->writeln("<fg=yellow>no database changes has been detected</fg=yellow>"); |
59 | 63 | |
60 | 64 | return $registry; |
61 | 65 | } |
62 | 66 | |
63 | - foreach ($this->changes as $change) { |
|
67 | + foreach ($this->changes as $change) |
|
68 | + { |
|
64 | 69 | $this->output->write(sprintf("• <fg=cyan>%s.%s</fg=cyan>", $change['database'], $change['table'])); |
65 | 70 | $this->describeChanges($change['schema']); |
66 | 71 | } |
@@ -73,22 +78,27 @@ discard block |
||
73 | 78 | */ |
74 | 79 | protected function describeChanges(AbstractTable $table) |
75 | 80 | { |
76 | - if (!$this->output->isVerbose()) { |
|
81 | + if (!$this->output->isVerbose()) |
|
82 | + { |
|
77 | 83 | $this->output->writeln(sprintf( |
78 | 84 | ": <fg=green>%s</fg=green> change(s) detected", |
79 | 85 | $this->numChanges($table) |
80 | 86 | )); |
81 | 87 | |
82 | 88 | return; |
83 | - } else { |
|
89 | + } |
|
90 | + else |
|
91 | + { |
|
84 | 92 | $this->output->write("\n"); |
85 | 93 | } |
86 | 94 | |
87 | - if (!$table->exists()) { |
|
95 | + if (!$table->exists()) |
|
96 | + { |
|
88 | 97 | $this->output->writeln(" - create table"); |
89 | 98 | } |
90 | 99 | |
91 | - if ($table->getStatus() === AbstractTable::STATUS_DECLARED_DROPPED) { |
|
100 | + if ($table->getStatus() === AbstractTable::STATUS_DECLARED_DROPPED) |
|
101 | + { |
|
92 | 102 | $this->output->writeln(" - drop table"); |
93 | 103 | return; |
94 | 104 | } |
@@ -105,15 +115,18 @@ discard block |
||
105 | 115 | */ |
106 | 116 | protected function describeColumns(Comparator $cmp) |
107 | 117 | { |
108 | - foreach ($cmp->addedColumns() as $column) { |
|
118 | + foreach ($cmp->addedColumns() as $column) |
|
119 | + { |
|
109 | 120 | $this->output->writeln(" - add column <fg=yellow>{$column->getName()}</fg=yellow>"); |
110 | 121 | } |
111 | 122 | |
112 | - foreach ($cmp->droppedColumns() as $column) { |
|
123 | + foreach ($cmp->droppedColumns() as $column) |
|
124 | + { |
|
113 | 125 | $this->output->writeln(" - drop column <fg=yellow>{$column->getName()}</fg=yellow>"); |
114 | 126 | } |
115 | 127 | |
116 | - foreach ($cmp->alteredColumns() as $column) { |
|
128 | + foreach ($cmp->alteredColumns() as $column) |
|
129 | + { |
|
117 | 130 | $column = $column[0]; |
118 | 131 | $this->output->writeln(" - alter column <fg=yellow>{$column->getName()}</fg=yellow>"); |
119 | 132 | } |
@@ -124,17 +137,20 @@ discard block |
||
124 | 137 | */ |
125 | 138 | protected function describeIndexes(Comparator $cmp) |
126 | 139 | { |
127 | - foreach ($cmp->addedIndexes() as $index) { |
|
140 | + foreach ($cmp->addedIndexes() as $index) |
|
141 | + { |
|
128 | 142 | $index = join(', ', $index->getColumns()); |
129 | 143 | $this->output->writeln(" - add index on <fg=yellow>[{$index}]</fg=yellow>"); |
130 | 144 | } |
131 | 145 | |
132 | - foreach ($cmp->droppedIndexes() as $index) { |
|
146 | + foreach ($cmp->droppedIndexes() as $index) |
|
147 | + { |
|
133 | 148 | $index = join(', ', $index->getColumns()); |
134 | 149 | $this->output->writeln(" - drop index on <fg=yellow>[{$index}]</fg=yellow>"); |
135 | 150 | } |
136 | 151 | |
137 | - foreach ($cmp->alteredIndexes() as $index) { |
|
152 | + foreach ($cmp->alteredIndexes() as $index) |
|
153 | + { |
|
138 | 154 | $index = $index[0]; |
139 | 155 | $index = join(', ', $index->getColumns()); |
140 | 156 | $this->output->writeln(" - alter index on <fg=yellow>[{$index}]</fg=yellow>"); |
@@ -146,15 +162,18 @@ discard block |
||
146 | 162 | */ |
147 | 163 | protected function describeFKs(Comparator $cmp) |
148 | 164 | { |
149 | - foreach ($cmp->addedForeignKeys() as $fk) { |
|
165 | + foreach ($cmp->addedForeignKeys() as $fk) |
|
166 | + { |
|
150 | 167 | $this->output->writeln(" - add foreign key on <fg=yellow>{$fk->getColumn()}</fg=yellow>"); |
151 | 168 | } |
152 | 169 | |
153 | - foreach ($cmp->droppedForeignKeys() as $fk) { |
|
170 | + foreach ($cmp->droppedForeignKeys() as $fk) |
|
171 | + { |
|
154 | 172 | $this->output->writeln(" - drop foreign key <fg=yellow>{$fk->getColumn()}</fg=yellow>"); |
155 | 173 | } |
156 | 174 | |
157 | - foreach ($cmp->alteredForeignKeys() as $fk) { |
|
175 | + foreach ($cmp->alteredForeignKeys() as $fk) |
|
176 | + { |
|
158 | 177 | $fk = $fk[0]; |
159 | 178 | $this->output->writeln(" - alter foreign key <fg=yellow>{$fk->getColumn()}</fg=yellow>"); |
160 | 179 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | EnvironmentInterface $env, |
46 | 46 | FinalizerInterface $finalizer, |
47 | 47 | ContainerInterface $container |
48 | - ) { |
|
48 | + ){ |
|
49 | 49 | $this->env = $env; |
50 | 50 | $this->finalizer = $finalizer; |
51 | 51 | $this->container = $container; |
@@ -74,11 +74,11 @@ discard block |
||
74 | 74 | /** @var Console $console */ |
75 | 75 | $console = $this->container->get(Console::class); |
76 | 76 | |
77 | - try { |
|
77 | + try{ |
|
78 | 78 | $console->start($input ?? new ArgvInput(), $output); |
79 | - } catch (\Throwable $e) { |
|
79 | + }catch (\Throwable $e){ |
|
80 | 80 | $this->handleException($e, $output); |
81 | - } finally { |
|
81 | + }finally{ |
|
82 | 82 | $listener->disable(); |
83 | 83 | $this->finalizer->finalize(false); |
84 | 84 | } |
@@ -90,9 +90,9 @@ discard block |
||
90 | 90 | */ |
91 | 91 | protected function handleException(\Throwable $e, OutputInterface $output) |
92 | 92 | { |
93 | - try { |
|
93 | + try{ |
|
94 | 94 | $this->container->get(SnapshotterInterface::class)->register($e); |
95 | - } catch (\Throwable|ContainerExceptionInterface $se) { |
|
95 | + }catch (\Throwable | ContainerExceptionInterface $se){ |
|
96 | 96 | // no need to notify when unable to register an exception |
97 | 97 | } |
98 | 98 | |
@@ -107,11 +107,11 @@ discard block |
||
107 | 107 | */ |
108 | 108 | private function mapVerbosity(OutputInterface $output): int |
109 | 109 | { |
110 | - if ($output->isDebug() || $output->isVeryVerbose()) { |
|
110 | + if ($output->isDebug() || $output->isVeryVerbose()){ |
|
111 | 111 | return ConsoleHandler::VERBOSITY_DEBUG; |
112 | 112 | } |
113 | 113 | |
114 | - if ($output->isVerbose()) { |
|
114 | + if ($output->isVerbose()){ |
|
115 | 115 | return ConsoleHandler::VERBOSITY_VERBOSE; |
116 | 116 | } |
117 | 117 |
@@ -74,11 +74,16 @@ discard block |
||
74 | 74 | /** @var Console $console */ |
75 | 75 | $console = $this->container->get(Console::class); |
76 | 76 | |
77 | - try { |
|
77 | + try |
|
78 | + { |
|
78 | 79 | $console->start($input ?? new ArgvInput(), $output); |
79 | - } catch (\Throwable $e) { |
|
80 | + } |
|
81 | + catch (\Throwable $e) |
|
82 | + { |
|
80 | 83 | $this->handleException($e, $output); |
81 | - } finally { |
|
84 | + } |
|
85 | + finally |
|
86 | + { |
|
82 | 87 | $listener->disable(); |
83 | 88 | $this->finalizer->finalize(false); |
84 | 89 | } |
@@ -90,9 +95,12 @@ discard block |
||
90 | 95 | */ |
91 | 96 | protected function handleException(\Throwable $e, OutputInterface $output) |
92 | 97 | { |
93 | - try { |
|
98 | + try |
|
99 | + { |
|
94 | 100 | $this->container->get(SnapshotterInterface::class)->register($e); |
95 | - } catch (\Throwable|ContainerExceptionInterface $se) { |
|
101 | + } |
|
102 | + catch (\Throwable|ContainerExceptionInterface $se) |
|
103 | + { |
|
96 | 104 | // no need to notify when unable to register an exception |
97 | 105 | } |
98 | 106 | |
@@ -107,11 +115,13 @@ discard block |
||
107 | 115 | */ |
108 | 116 | private function mapVerbosity(OutputInterface $output): int |
109 | 117 | { |
110 | - if ($output->isDebug() || $output->isVeryVerbose()) { |
|
118 | + if ($output->isDebug() || $output->isVeryVerbose()) |
|
119 | + { |
|
111 | 120 | return ConsoleHandler::VERBOSITY_DEBUG; |
112 | 121 | } |
113 | 122 | |
114 | - if ($output->isVerbose()) { |
|
123 | + if ($output->isVerbose()) |
|
124 | + { |
|
115 | 125 | return ConsoleHandler::VERBOSITY_VERBOSE; |
116 | 126 | } |
117 | 127 |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | HttpConfig $httpConfig, |
52 | 52 | SessionFactory $factory, |
53 | 53 | ScopeInterface $scope |
54 | - ) { |
|
54 | + ){ |
|
55 | 55 | $this->config = $config; |
56 | 56 | $this->httpConfig = $httpConfig; |
57 | 57 | $this->factory = $factory; |
@@ -69,14 +69,14 @@ discard block |
||
69 | 69 | $this->fetchID($request) |
70 | 70 | ); |
71 | 71 | |
72 | - try { |
|
72 | + try{ |
|
73 | 73 | $response = $this->scope->runScope( |
74 | 74 | [SessionInterface::class => $session], |
75 | 75 | function () use ($session, $request, $handler) { |
76 | 76 | return $handler->handle($request->withAttribute(static::ATTRIBUTE, $session)); |
77 | 77 | } |
78 | 78 | ); |
79 | - } catch (\Throwable $e) { |
|
79 | + }catch (\Throwable $e){ |
|
80 | 80 | $session->abort(); |
81 | 81 | throw $e; |
82 | 82 | } |
@@ -95,14 +95,14 @@ discard block |
||
95 | 95 | Request $request, |
96 | 96 | Response $response |
97 | 97 | ): Response { |
98 | - if (!$session->isStarted()) { |
|
98 | + if (!$session->isStarted()){ |
|
99 | 99 | return $response; |
100 | 100 | } |
101 | 101 | |
102 | 102 | $session->commit(); |
103 | 103 | |
104 | 104 | //SID changed |
105 | - if ($this->fetchID($request) != $session->getID()) { |
|
105 | + if ($this->fetchID($request) != $session->getID()){ |
|
106 | 106 | return $this->withCookie($request, $response, $session->getID()); |
107 | 107 | } |
108 | 108 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | protected function fetchID(Request $request): ?string |
120 | 120 | { |
121 | 121 | $cookies = $request->getCookieParams(); |
122 | - if (empty($cookies[$this->config->getCookie()])) { |
|
122 | + if (empty($cookies[$this->config->getCookie()])){ |
|
123 | 123 | return null; |
124 | 124 | } |
125 | 125 | |
@@ -152,8 +152,8 @@ discard block |
||
152 | 152 | protected function clientSignature(Request $request): string |
153 | 153 | { |
154 | 154 | $signature = ''; |
155 | - foreach (static::SIGNATURE_HEADERS as $header) { |
|
156 | - $signature .= $request->getHeaderLine($header) . ';'; |
|
155 | + foreach (static::SIGNATURE_HEADERS as $header){ |
|
156 | + $signature .= $request->getHeaderLine($header).';'; |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | return hash('sha256', $signature); |
@@ -69,14 +69,18 @@ discard block |
||
69 | 69 | $this->fetchID($request) |
70 | 70 | ); |
71 | 71 | |
72 | - try { |
|
72 | + try |
|
73 | + { |
|
73 | 74 | $response = $this->scope->runScope( |
74 | 75 | [SessionInterface::class => $session], |
75 | - function () use ($session, $request, $handler) { |
|
76 | + function () use ($session, $request, $handler) |
|
77 | + { |
|
76 | 78 | return $handler->handle($request->withAttribute(static::ATTRIBUTE, $session)); |
77 | 79 | } |
78 | 80 | ); |
79 | - } catch (\Throwable $e) { |
|
81 | + } |
|
82 | + catch (\Throwable $e) |
|
83 | + { |
|
80 | 84 | $session->abort(); |
81 | 85 | throw $e; |
82 | 86 | } |
@@ -95,14 +99,16 @@ discard block |
||
95 | 99 | Request $request, |
96 | 100 | Response $response |
97 | 101 | ): Response { |
98 | - if (!$session->isStarted()) { |
|
102 | + if (!$session->isStarted()) |
|
103 | + { |
|
99 | 104 | return $response; |
100 | 105 | } |
101 | 106 | |
102 | 107 | $session->commit(); |
103 | 108 | |
104 | 109 | //SID changed |
105 | - if ($this->fetchID($request) != $session->getID()) { |
|
110 | + if ($this->fetchID($request) != $session->getID()) |
|
111 | + { |
|
106 | 112 | return $this->withCookie($request, $response, $session->getID()); |
107 | 113 | } |
108 | 114 | |
@@ -119,7 +125,8 @@ discard block |
||
119 | 125 | protected function fetchID(Request $request): ?string |
120 | 126 | { |
121 | 127 | $cookies = $request->getCookieParams(); |
122 | - if (empty($cookies[$this->config->getCookie()])) { |
|
128 | + if (empty($cookies[$this->config->getCookie()])) |
|
129 | + { |
|
123 | 130 | return null; |
124 | 131 | } |
125 | 132 | |
@@ -152,7 +159,8 @@ discard block |
||
152 | 159 | protected function clientSignature(Request $request): string |
153 | 160 | { |
154 | 161 | $signature = ''; |
155 | - foreach (static::SIGNATURE_HEADERS as $header) { |
|
162 | + foreach (static::SIGNATURE_HEADERS as $header) |
|
163 | + { |
|
156 | 164 | $signature .= $request->getHeaderLine($header) . ';'; |
157 | 165 | } |
158 | 166 |
@@ -59,12 +59,12 @@ discard block |
||
59 | 59 | $http = $this->container->get(HttpCore::class); |
60 | 60 | $emitter = $emitter ?? $this->container->get(EmitterInterface::class); |
61 | 61 | |
62 | - try { |
|
62 | + try{ |
|
63 | 63 | $response = $http->handle($this->initRequest()); |
64 | 64 | $emitter->emit($response); |
65 | - } catch (\Throwable $e) { |
|
65 | + }catch (\Throwable $e){ |
|
66 | 66 | $this->handleException($emitter, $e); |
67 | - } finally { |
|
67 | + }finally{ |
|
68 | 68 | $this->finalizer->finalize(false); |
69 | 69 | } |
70 | 70 | } |
@@ -85,10 +85,10 @@ discard block |
||
85 | 85 | { |
86 | 86 | $handler = new HtmlHandler(HtmlHandler::INVERTED); |
87 | 87 | |
88 | - try { |
|
88 | + try{ |
|
89 | 89 | /** @var SnapshotInterface $snapshot */ |
90 | 90 | $this->container->get(SnapshotterInterface::class)->register($e); |
91 | - } catch (\Throwable|ContainerExceptionInterface $se) { |
|
91 | + }catch (\Throwable | ContainerExceptionInterface $se){ |
|
92 | 92 | // nothing to report |
93 | 93 | } |
94 | 94 |
@@ -59,12 +59,17 @@ discard block |
||
59 | 59 | $http = $this->container->get(HttpCore::class); |
60 | 60 | $emitter = $emitter ?? $this->container->get(EmitterInterface::class); |
61 | 61 | |
62 | - try { |
|
62 | + try |
|
63 | + { |
|
63 | 64 | $response = $http->handle($this->initRequest()); |
64 | 65 | $emitter->emit($response); |
65 | - } catch (\Throwable $e) { |
|
66 | + } |
|
67 | + catch (\Throwable $e) |
|
68 | + { |
|
66 | 69 | $this->handleException($emitter, $e); |
67 | - } finally { |
|
70 | + } |
|
71 | + finally |
|
72 | + { |
|
68 | 73 | $this->finalizer->finalize(false); |
69 | 74 | } |
70 | 75 | } |
@@ -85,10 +90,13 @@ discard block |
||
85 | 90 | { |
86 | 91 | $handler = new HtmlHandler(HtmlHandler::INVERTED); |
87 | 92 | |
88 | - try { |
|
93 | + try |
|
94 | + { |
|
89 | 95 | /** @var SnapshotInterface $snapshot */ |
90 | 96 | $this->container->get(SnapshotterInterface::class)->register($e); |
91 | - } catch (\Throwable|ContainerExceptionInterface $se) { |
|
97 | + } |
|
98 | + catch (\Throwable|ContainerExceptionInterface $se) |
|
99 | + { |
|
92 | 100 | // nothing to report |
93 | 101 | } |
94 | 102 |