@@ -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 | |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | { |
| 17 | 17 | $output = $this->runCommand('php:extensions'); |
| 18 | 18 | |
| 19 | - foreach (get_loaded_extensions() as $extension) { |
|
| 19 | + foreach (get_loaded_extensions() as $extension){ |
|
| 20 | 20 | $this->assertContains($extension, $output); |
| 21 | 21 | } |
| 22 | 22 | } |
@@ -16,7 +16,8 @@ |
||
| 16 | 16 | { |
| 17 | 17 | $output = $this->runCommand('php:extensions'); |
| 18 | 18 | |
| 19 | - foreach (get_loaded_extensions() as $extension) { |
|
| 19 | + foreach (get_loaded_extensions() as $extension) |
|
| 20 | + { |
|
| 20 | 21 | $this->assertContains($extension, $output); |
| 21 | 22 | } |
| 22 | 23 | } |
@@ -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 | } |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | */ |
| 37 | 37 | $dirs = $this->app->get(DirectoriesInterface::class); |
| 38 | 38 | $fs = $this->app->get(FilesInterface::class); |
| 39 | - $fs->write($dirs->get('cache') . '/views/test.php', 'test', null, true); |
|
| 39 | + $fs->write($dirs->get('cache').'/views/test.php', 'test', null, true); |
|
| 40 | 40 | |
| 41 | 41 | $out = $this->runCommandDebug('views:reset'); |
| 42 | 42 | $this->assertContains('test.php', $out); |
@@ -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, |
@@ -39,10 +39,13 @@ |
||
| 39 | 39 | |
| 40 | 40 | $user = file_get_contents(__DIR__ . '/../../app/src/User/User.php'); |
| 41 | 41 | unlink(__DIR__ . '/../../app/src/User/User.php'); |
| 42 | - try { |
|
| 42 | + try |
|
| 43 | + { |
|
| 43 | 44 | $output = $this->runCommandDebug('cycle:migrate', ['-r' => true]); |
| 44 | 45 | $this->assertContains('drop foreign key', $output); |
| 45 | - } finally { |
|
| 46 | + } |
|
| 47 | + finally |
|
| 48 | + { |
|
| 46 | 49 | file_put_contents(__DIR__ . '/../../app/src/User/User.php', $user); |
| 47 | 50 | } |
| 48 | 51 | } |
@@ -50,13 +50,13 @@ |
||
| 50 | 50 | $output = $this->runCommandDebug('cycle:migrate', ['-r' => true]); |
| 51 | 51 | $this->assertContains('default.users', $output); |
| 52 | 52 | |
| 53 | - $user = file_get_contents(__DIR__ . '/../../app/src/User/User.php'); |
|
| 54 | - unlink(__DIR__ . '/../../app/src/User/User.php'); |
|
| 55 | - try { |
|
| 53 | + $user = file_get_contents(__DIR__.'/../../app/src/User/User.php'); |
|
| 54 | + unlink(__DIR__.'/../../app/src/User/User.php'); |
|
| 55 | + try{ |
|
| 56 | 56 | $output = $this->runCommandDebug('cycle:migrate', ['-r' => true]); |
| 57 | 57 | $this->assertContains('drop foreign key', $output); |
| 58 | - } finally { |
|
| 59 | - file_put_contents(__DIR__ . '/../../app/src/User/User.php', $user); |
|
| 58 | + }finally{ |
|
| 59 | + file_put_contents(__DIR__.'/../../app/src/User/User.php', $user); |
|
| 60 | 60 | } |
| 61 | 61 | } |
| 62 | 62 | } |
@@ -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 | |