@@ -43,7 +43,7 @@ |
||
43 | 43 | |
44 | 44 | if (!$schema->exists()) { |
45 | 45 | throw new DBALException( |
46 | - "Table {$database->getName()}.{$this->argument('table')} does not exists." |
|
46 | + "table {$database->getName()}.{$this->argument('table')} does not exists." |
|
47 | 47 | ); |
48 | 48 | } |
49 | 49 |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $database = $dbal->database($this->option('database')); |
45 | 45 | $schema = $database->table($this->argument('table'))->getSchema(); |
46 | 46 | |
47 | - if (!$schema->exists()) { |
|
47 | + if (!$schema->exists()){ |
|
48 | 48 | throw new DBALException( |
49 | 49 | "Table {$database->getName()}.{$this->argument('table')} does not exists." |
50 | 50 | ); |
@@ -58,11 +58,11 @@ discard block |
||
58 | 58 | |
59 | 59 | $this->describeColumns($schema); |
60 | 60 | |
61 | - if (!empty($indexes = $schema->getIndexes())) { |
|
61 | + if (!empty($indexes = $schema->getIndexes())){ |
|
62 | 62 | $this->describeIndexes($database, $indexes); |
63 | 63 | } |
64 | 64 | |
65 | - if (!empty($foreignKeys = $schema->getForeignKeys())) { |
|
65 | + if (!empty($foreignKeys = $schema->getForeignKeys())){ |
|
66 | 66 | $this->describeForeignKeys($database, $foreignKeys); |
67 | 67 | } |
68 | 68 | |
@@ -84,10 +84,10 @@ discard block |
||
84 | 84 | ] |
85 | 85 | ); |
86 | 86 | |
87 | - foreach ($schema->getColumns() as $column) { |
|
87 | + foreach ($schema->getColumns() as $column){ |
|
88 | 88 | $name = $column->getName(); |
89 | 89 | |
90 | - if (in_array($column->getName(), $schema->getPrimaryKeys(), true)) { |
|
90 | + if (in_array($column->getName(), $schema->getPrimaryKeys(), true)){ |
|
91 | 91 | $name = "<fg=magenta>{$name}</fg=magenta>"; |
92 | 92 | } |
93 | 93 | |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | ); |
121 | 121 | |
122 | 122 | $indexesTable = $this->table(['Name:', 'Type:', 'Columns:']); |
123 | - foreach ($indexes as $index) { |
|
123 | + foreach ($indexes as $index){ |
|
124 | 124 | $indexesTable->addRow( |
125 | 125 | [ |
126 | 126 | $index->getName(), |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | ] |
156 | 156 | ); |
157 | 157 | |
158 | - foreach ($foreignKeys as $reference) { |
|
158 | + foreach ($foreignKeys as $reference){ |
|
159 | 159 | $foreignTable->addRow( |
160 | 160 | [ |
161 | 161 | $reference->getName(), |
@@ -180,13 +180,13 @@ discard block |
||
180 | 180 | { |
181 | 181 | $defaultValue = $column->getDefaultValue(); |
182 | 182 | |
183 | - if ($defaultValue instanceof FragmentInterface) { |
|
183 | + if ($defaultValue instanceof FragmentInterface){ |
|
184 | 184 | $value = $driver->getQueryCompiler()->compile(new QueryParameters(), '', $defaultValue); |
185 | 185 | |
186 | 186 | return "<info>{$value}</info>"; |
187 | 187 | } |
188 | 188 | |
189 | - if ($defaultValue instanceof \DateTimeInterface) { |
|
189 | + if ($defaultValue instanceof \DateTimeInterface){ |
|
190 | 190 | $defaultValue = $defaultValue->format('c'); |
191 | 191 | } |
192 | 192 | |
@@ -203,11 +203,11 @@ discard block |
||
203 | 203 | |
204 | 204 | $abstractType = $column->getAbstractType(); |
205 | 205 | |
206 | - if ($column->getSize()) { |
|
206 | + if ($column->getSize()){ |
|
207 | 207 | $type .= " ({$column->getSize()})"; |
208 | 208 | } |
209 | 209 | |
210 | - if ($abstractType === 'decimal') { |
|
210 | + if ($abstractType === 'decimal'){ |
|
211 | 211 | $type .= " ({$column->getPrecision()}, {$column->getScale()})"; |
212 | 212 | } |
213 | 213 | |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | { |
223 | 223 | $abstractType = $column->getAbstractType(); |
224 | 224 | |
225 | - if (in_array($abstractType, ['primary', 'bigPrimary'])) { |
|
225 | + if (in_array($abstractType, ['primary', 'bigPrimary'])){ |
|
226 | 226 | $abstractType = "<fg=magenta>{$abstractType}</fg=magenta>"; |
227 | 227 | } |
228 | 228 |
@@ -44,7 +44,8 @@ discard block |
||
44 | 44 | $database = $dbal->database($this->option('database')); |
45 | 45 | $schema = $database->table($this->argument('table'))->getSchema(); |
46 | 46 | |
47 | - if (!$schema->exists()) { |
|
47 | + if (!$schema->exists()) |
|
48 | + { |
|
48 | 49 | throw new DBALException( |
49 | 50 | "Table {$database->getName()}.{$this->argument('table')} does not exists." |
50 | 51 | ); |
@@ -58,11 +59,13 @@ discard block |
||
58 | 59 | |
59 | 60 | $this->describeColumns($schema); |
60 | 61 | |
61 | - if (!empty($indexes = $schema->getIndexes())) { |
|
62 | + if (!empty($indexes = $schema->getIndexes())) |
|
63 | + { |
|
62 | 64 | $this->describeIndexes($database, $indexes); |
63 | 65 | } |
64 | 66 | |
65 | - if (!empty($foreignKeys = $schema->getForeignKeys())) { |
|
67 | + if (!empty($foreignKeys = $schema->getForeignKeys())) |
|
68 | + { |
|
66 | 69 | $this->describeForeignKeys($database, $foreignKeys); |
67 | 70 | } |
68 | 71 | |
@@ -84,10 +87,12 @@ discard block |
||
84 | 87 | ] |
85 | 88 | ); |
86 | 89 | |
87 | - foreach ($schema->getColumns() as $column) { |
|
90 | + foreach ($schema->getColumns() as $column) |
|
91 | + { |
|
88 | 92 | $name = $column->getName(); |
89 | 93 | |
90 | - if (in_array($column->getName(), $schema->getPrimaryKeys(), true)) { |
|
94 | + if (in_array($column->getName(), $schema->getPrimaryKeys(), true)) |
|
95 | + { |
|
91 | 96 | $name = "<fg=magenta>{$name}</fg=magenta>"; |
92 | 97 | } |
93 | 98 | |
@@ -120,7 +125,8 @@ discard block |
||
120 | 125 | ); |
121 | 126 | |
122 | 127 | $indexesTable = $this->table(['Name:', 'Type:', 'Columns:']); |
123 | - foreach ($indexes as $index) { |
|
128 | + foreach ($indexes as $index) |
|
129 | + { |
|
124 | 130 | $indexesTable->addRow( |
125 | 131 | [ |
126 | 132 | $index->getName(), |
@@ -155,7 +161,8 @@ discard block |
||
155 | 161 | ] |
156 | 162 | ); |
157 | 163 | |
158 | - foreach ($foreignKeys as $reference) { |
|
164 | + foreach ($foreignKeys as $reference) |
|
165 | + { |
|
159 | 166 | $foreignTable->addRow( |
160 | 167 | [ |
161 | 168 | $reference->getName(), |
@@ -180,13 +187,15 @@ discard block |
||
180 | 187 | { |
181 | 188 | $defaultValue = $column->getDefaultValue(); |
182 | 189 | |
183 | - if ($defaultValue instanceof FragmentInterface) { |
|
190 | + if ($defaultValue instanceof FragmentInterface) |
|
191 | + { |
|
184 | 192 | $value = $driver->getQueryCompiler()->compile(new QueryParameters(), '', $defaultValue); |
185 | 193 | |
186 | 194 | return "<info>{$value}</info>"; |
187 | 195 | } |
188 | 196 | |
189 | - if ($defaultValue instanceof \DateTimeInterface) { |
|
197 | + if ($defaultValue instanceof \DateTimeInterface) |
|
198 | + { |
|
190 | 199 | $defaultValue = $defaultValue->format('c'); |
191 | 200 | } |
192 | 201 | |
@@ -203,11 +212,13 @@ discard block |
||
203 | 212 | |
204 | 213 | $abstractType = $column->getAbstractType(); |
205 | 214 | |
206 | - if ($column->getSize()) { |
|
215 | + if ($column->getSize()) |
|
216 | + { |
|
207 | 217 | $type .= " ({$column->getSize()})"; |
208 | 218 | } |
209 | 219 | |
210 | - if ($abstractType === 'decimal') { |
|
220 | + if ($abstractType === 'decimal') |
|
221 | + { |
|
211 | 222 | $type .= " ({$column->getPrecision()}, {$column->getScale()})"; |
212 | 223 | } |
213 | 224 | |
@@ -222,7 +233,8 @@ discard block |
||
222 | 233 | { |
223 | 234 | $abstractType = $column->getAbstractType(); |
224 | 235 | |
225 | - if (in_array($abstractType, ['primary', 'bigPrimary'])) { |
|
236 | + if (in_array($abstractType, ['primary', 'bigPrimary'])) |
|
237 | + { |
|
226 | 238 | $abstractType = "<fg=magenta>{$abstractType}</fg=magenta>"; |
227 | 239 | } |
228 | 240 |
@@ -31,12 +31,12 @@ |
||
31 | 31 | |
32 | 32 | $fs = new Files(); |
33 | 33 | |
34 | - if ($fs->isDirectory(__DIR__ . '/../app/migrations')) { |
|
35 | - $fs->deleteDirectory(__DIR__ . '/../app/migrations'); |
|
34 | + if ($fs->isDirectory(__DIR__.'/../app/migrations')){ |
|
35 | + $fs->deleteDirectory(__DIR__.'/../app/migrations'); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | $runtime = $this->app->get(DirectoriesInterface::class)->get('runtime'); |
39 | - if ($fs->isDirectory($runtime)) { |
|
39 | + if ($fs->isDirectory($runtime)){ |
|
40 | 40 | $fs->deleteDirectory($runtime); |
41 | 41 | } |
42 | 42 | } |
@@ -31,12 +31,14 @@ |
||
31 | 31 | |
32 | 32 | $fs = new Files(); |
33 | 33 | |
34 | - if ($fs->isDirectory(__DIR__ . '/../app/migrations')) { |
|
34 | + if ($fs->isDirectory(__DIR__ . '/../app/migrations')) |
|
35 | + { |
|
35 | 36 | $fs->deleteDirectory(__DIR__ . '/../app/migrations'); |
36 | 37 | } |
37 | 38 | |
38 | 39 | $runtime = $this->app->get(DirectoriesInterface::class)->get('runtime'); |
39 | - if ($fs->isDirectory($runtime)) { |
|
40 | + if ($fs->isDirectory($runtime)) |
|
41 | + { |
|
40 | 42 | $fs->deleteDirectory($runtime); |
41 | 43 | } |
42 | 44 | } |
@@ -133,7 +133,8 @@ |
||
133 | 133 | string $footer, |
134 | 134 | array $options |
135 | 135 | ): Append { |
136 | - if (is_array($sequence) || $sequence instanceof \Closure) { |
|
136 | + if (is_array($sequence) || $sequence instanceof \Closure) |
|
137 | + { |
|
137 | 138 | return new Append( |
138 | 139 | $target, |
139 | 140 | null, |
@@ -128,7 +128,7 @@ |
||
128 | 128 | string $footer, |
129 | 129 | array $options |
130 | 130 | ): Append { |
131 | - if (is_array($sequence) || $sequence instanceof \Closure) { |
|
131 | + if (is_array($sequence) || $sequence instanceof \Closure){ |
|
132 | 132 | return new Append( |
133 | 133 | $target, |
134 | 134 | null, |
@@ -38,15 +38,15 @@ |
||
38 | 38 | public function getServices(): array |
39 | 39 | { |
40 | 40 | $result = []; |
41 | - foreach ($this->classes->getClasses(ServiceInterface::class) as $service) { |
|
42 | - if (!$service->isInstantiable()) { |
|
41 | + foreach ($this->classes->getClasses(ServiceInterface::class) as $service){ |
|
42 | + if (!$service->isInstantiable()){ |
|
43 | 43 | continue; |
44 | 44 | } |
45 | 45 | |
46 | 46 | $instance = $this->container->get($service->getName()); |
47 | 47 | |
48 | - foreach ($service->getInterfaces() as $interface) { |
|
49 | - if ($interface->isSubclassOf(ServiceInterface::class)) { |
|
48 | + foreach ($service->getInterfaces() as $interface){ |
|
49 | + if ($interface->isSubclassOf(ServiceInterface::class)){ |
|
50 | 50 | $result[$interface->getName()] = $instance; |
51 | 51 | } |
52 | 52 | } |
@@ -38,15 +38,19 @@ |
||
38 | 38 | public function getServices(): array |
39 | 39 | { |
40 | 40 | $result = []; |
41 | - foreach ($this->classes->getClasses(ServiceInterface::class) as $service) { |
|
42 | - if (!$service->isInstantiable()) { |
|
41 | + foreach ($this->classes->getClasses(ServiceInterface::class) as $service) |
|
42 | + { |
|
43 | + if (!$service->isInstantiable()) |
|
44 | + { |
|
43 | 45 | continue; |
44 | 46 | } |
45 | 47 | |
46 | 48 | $instance = $this->container->get($service->getName()); |
47 | 49 | |
48 | - foreach ($service->getInterfaces() as $interface) { |
|
49 | - if ($interface->isSubclassOf(ServiceInterface::class)) { |
|
50 | + foreach ($service->getInterfaces() as $interface) |
|
51 | + { |
|
52 | + if ($interface->isSubclassOf(ServiceInterface::class)) |
|
53 | + { |
|
50 | 54 | $result[$interface->getName()] = $instance; |
51 | 55 | } |
52 | 56 | } |
@@ -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 |
@@ -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 |
@@ -40,21 +40,21 @@ discard block |
||
40 | 40 | { |
41 | 41 | $conn = $env->get('RR_RPC', static::RPC_DEFAULT); |
42 | 42 | |
43 | - if (!preg_match('#^([a-z]+)://([^:]+):?(\d+)?$#i', $conn, $parts)) { |
|
43 | + if (!preg_match('#^([a-z]+)://([^:]+):?(\d+)?$#i', $conn, $parts)){ |
|
44 | 44 | throw new BootException( |
45 | 45 | "Unable to configure RPC connection, invalid DSN given `{$conn}`." |
46 | 46 | ); |
47 | 47 | } |
48 | 48 | |
49 | - if (!in_array($parts[1], ['tcp', 'unix'])) { |
|
49 | + if (!in_array($parts[1], ['tcp', 'unix'])){ |
|
50 | 50 | throw new BootException( |
51 | 51 | "Unable to configure RPC connection, invalid DSN given `{$conn}`." |
52 | 52 | ); |
53 | 53 | } |
54 | 54 | |
55 | - if ($parts[1] == 'unix') { |
|
55 | + if ($parts[1] == 'unix'){ |
|
56 | 56 | $relay = new SocketRelay($parts[2], null, SocketRelay::SOCK_UNIX); |
57 | - } else { |
|
57 | + }else{ |
|
58 | 58 | $relay = new SocketRelay($parts[2], (int)$parts[3], SocketRelay::SOCK_TCP); |
59 | 59 | } |
60 | 60 | |
@@ -69,25 +69,25 @@ discard block |
||
69 | 69 | { |
70 | 70 | $conn = $env->get('RR_RELAY', static::WORKER_DEFAULT); |
71 | 71 | |
72 | - if ($conn === 'pipes' || empty($conn)) { |
|
72 | + if ($conn === 'pipes' || empty($conn)){ |
|
73 | 73 | return new Worker(new StreamRelay(STDIN, STDOUT)); |
74 | 74 | } |
75 | 75 | |
76 | - if (!preg_match('#^([a-z]+)://([^:]+):?(\d+)?$#i', $conn, $parts)) { |
|
76 | + if (!preg_match('#^([a-z]+)://([^:]+):?(\d+)?$#i', $conn, $parts)){ |
|
77 | 77 | throw new BootException( |
78 | 78 | "Unable to configure Worker connection, invalid DSN given `{$conn}`." |
79 | 79 | ); |
80 | 80 | } |
81 | 81 | |
82 | - if (!in_array($parts[1], ['tcp', 'unix'])) { |
|
82 | + if (!in_array($parts[1], ['tcp', 'unix'])){ |
|
83 | 83 | throw new BootException( |
84 | 84 | "Unable to configure Worker connection, invalid DSN given `{$conn}`." |
85 | 85 | ); |
86 | 86 | } |
87 | 87 | |
88 | - if ($parts[1] == 'unix') { |
|
88 | + if ($parts[1] == 'unix'){ |
|
89 | 89 | $relay = new SocketRelay($parts[2], null, SocketRelay::SOCK_UNIX); |
90 | - } else { |
|
90 | + }else{ |
|
91 | 91 | $relay = new SocketRelay($parts[2], (int)$parts[3], SocketRelay::SOCK_TCP); |
92 | 92 | } |
93 | 93 |
@@ -40,21 +40,26 @@ discard block |
||
40 | 40 | { |
41 | 41 | $conn = $env->get('RR_RPC', static::RPC_DEFAULT); |
42 | 42 | |
43 | - if (!preg_match('#^([a-z]+)://([^:]+):?(\d+)?$#i', $conn, $parts)) { |
|
43 | + if (!preg_match('#^([a-z]+)://([^:]+):?(\d+)?$#i', $conn, $parts)) |
|
44 | + { |
|
44 | 45 | throw new BootException( |
45 | 46 | "Unable to configure RPC connection, invalid DSN given `{$conn}`." |
46 | 47 | ); |
47 | 48 | } |
48 | 49 | |
49 | - if (!in_array($parts[1], ['tcp', 'unix'])) { |
|
50 | + if (!in_array($parts[1], ['tcp', 'unix'])) |
|
51 | + { |
|
50 | 52 | throw new BootException( |
51 | 53 | "Unable to configure RPC connection, invalid DSN given `{$conn}`." |
52 | 54 | ); |
53 | 55 | } |
54 | 56 | |
55 | - if ($parts[1] == 'unix') { |
|
57 | + if ($parts[1] == 'unix') |
|
58 | + { |
|
56 | 59 | $relay = new SocketRelay($parts[2], null, SocketRelay::SOCK_UNIX); |
57 | - } else { |
|
60 | + } |
|
61 | + else |
|
62 | + { |
|
58 | 63 | $relay = new SocketRelay($parts[2], (int)$parts[3], SocketRelay::SOCK_TCP); |
59 | 64 | } |
60 | 65 | |
@@ -69,25 +74,31 @@ discard block |
||
69 | 74 | { |
70 | 75 | $conn = $env->get('RR_RELAY', static::WORKER_DEFAULT); |
71 | 76 | |
72 | - if ($conn === 'pipes' || empty($conn)) { |
|
77 | + if ($conn === 'pipes' || empty($conn)) |
|
78 | + { |
|
73 | 79 | return new Worker(new StreamRelay(STDIN, STDOUT)); |
74 | 80 | } |
75 | 81 | |
76 | - if (!preg_match('#^([a-z]+)://([^:]+):?(\d+)?$#i', $conn, $parts)) { |
|
82 | + if (!preg_match('#^([a-z]+)://([^:]+):?(\d+)?$#i', $conn, $parts)) |
|
83 | + { |
|
77 | 84 | throw new BootException( |
78 | 85 | "Unable to configure Worker connection, invalid DSN given `{$conn}`." |
79 | 86 | ); |
80 | 87 | } |
81 | 88 | |
82 | - if (!in_array($parts[1], ['tcp', 'unix'])) { |
|
89 | + if (!in_array($parts[1], ['tcp', 'unix'])) |
|
90 | + { |
|
83 | 91 | throw new BootException( |
84 | 92 | "Unable to configure Worker connection, invalid DSN given `{$conn}`." |
85 | 93 | ); |
86 | 94 | } |
87 | 95 | |
88 | - if ($parts[1] == 'unix') { |
|
96 | + if ($parts[1] == 'unix') |
|
97 | + { |
|
89 | 98 | $relay = new SocketRelay($parts[2], null, SocketRelay::SOCK_UNIX); |
90 | - } else { |
|
99 | + } |
|
100 | + else |
|
101 | + { |
|
91 | 102 | $relay = new SocketRelay($parts[2], (int)$parts[3], SocketRelay::SOCK_TCP); |
92 | 103 | } |
93 | 104 |
@@ -17,10 +17,10 @@ |
||
17 | 17 | public function makeApp(array $env = []): TestApp |
18 | 18 | { |
19 | 19 | return TestApp::init([ |
20 | - 'root' => __DIR__ . '/../..', |
|
21 | - 'app' => __DIR__ . '/../app', |
|
22 | - 'runtime' => sys_get_temp_dir() . '/spiral', |
|
23 | - 'cache' => sys_get_temp_dir() . '/spiral', |
|
20 | + 'root' => __DIR__.'/../..', |
|
21 | + 'app' => __DIR__.'/../app', |
|
22 | + 'runtime' => sys_get_temp_dir().'/spiral', |
|
23 | + 'cache' => sys_get_temp_dir().'/spiral', |
|
24 | 24 | ], new Environment($env), false); |
25 | 25 | } |
26 | 26 | } |
@@ -37,8 +37,8 @@ |
||
37 | 37 | public function locateCommands(): array |
38 | 38 | { |
39 | 39 | $commands = []; |
40 | - foreach ($this->classes->getClasses(SymfonyCommand::class) as $class) { |
|
41 | - if ($class->isAbstract()) { |
|
40 | + foreach ($this->classes->getClasses(SymfonyCommand::class) as $class){ |
|
41 | + if ($class->isAbstract()){ |
|
42 | 42 | continue; |
43 | 43 | } |
44 | 44 |
@@ -37,8 +37,10 @@ |
||
37 | 37 | public function locateCommands(): array |
38 | 38 | { |
39 | 39 | $commands = []; |
40 | - foreach ($this->classes->getClasses(SymfonyCommand::class) as $class) { |
|
41 | - if ($class->isAbstract()) { |
|
40 | + foreach ($this->classes->getClasses(SymfonyCommand::class) as $class) |
|
41 | + { |
|
42 | + if ($class->isAbstract()) |
|
43 | + { |
|
42 | 44 | continue; |
43 | 45 | } |
44 | 46 |