@@ -9,4 +9,4 @@ |
||
| 9 | 9 | ini_set('display_errors', true); |
| 10 | 10 | |
| 11 | 11 | //Composer |
| 12 | -require dirname(__DIR__) . '/vendor/autoload.php'; |
|
| 13 | 12 | \ No newline at end of file |
| 13 | +require dirname(__DIR__).'/vendor/autoload.php'; |
|
| 14 | 14 | \ No newline at end of file |
@@ -23,14 +23,14 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | public function perform() |
| 25 | 25 | { |
| 26 | - if (!$this->verifyConfigured() || !$this->verifyEnvironment()) { |
|
| 26 | + if (!$this->verifyConfigured() || !$this->verifyEnvironment()){ |
|
| 27 | 27 | return; |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | $found = false; |
| 31 | 31 | $count = $this->option('one') ? 1 : PHP_INT_MAX; |
| 32 | 32 | |
| 33 | - while ($count > 0 && ($migration = $this->migrator->run())) { |
|
| 33 | + while ($count > 0 && ($migration = $this->migrator->run())){ |
|
| 34 | 34 | $found = true; |
| 35 | 35 | $count--; |
| 36 | 36 | |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | ); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - if (!$found) { |
|
| 43 | + if (!$found){ |
|
| 44 | 44 | $this->writeln("<fg=red>No outstanding migrations were found.</fg=red>"); |
| 45 | 45 | } |
| 46 | 46 | } |
@@ -23,14 +23,16 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | public function perform() |
| 25 | 25 | { |
| 26 | - if (!$this->verifyConfigured() || !$this->verifyEnvironment()) { |
|
| 26 | + if (!$this->verifyConfigured() || !$this->verifyEnvironment()) |
|
| 27 | + { |
|
| 27 | 28 | return; |
| 28 | 29 | } |
| 29 | 30 | |
| 30 | 31 | $found = false; |
| 31 | 32 | $count = $this->option('one') ? 1 : PHP_INT_MAX; |
| 32 | 33 | |
| 33 | - while ($count > 0 && ($migration = $this->migrator->run())) { |
|
| 34 | + while ($count > 0 && ($migration = $this->migrator->run())) |
|
| 35 | + { |
|
| 34 | 36 | $found = true; |
| 35 | 37 | $count--; |
| 36 | 38 | |
@@ -40,7 +42,8 @@ discard block |
||
| 40 | 42 | ); |
| 41 | 43 | } |
| 42 | 44 | |
| 43 | - if (!$found) { |
|
| 45 | + if (!$found) |
|
| 46 | + { |
|
| 44 | 47 | $this->writeln("<fg=red>No outstanding migrations were found.</fg=red>"); |
| 45 | 48 | } |
| 46 | 49 | } |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | protected function verifyConfigured(): bool |
| 42 | 42 | { |
| 43 | - if (!$this->migrator->isConfigured()) { |
|
| 43 | + if (!$this->migrator->isConfigured()){ |
|
| 44 | 44 | $this->writeln( |
| 45 | 45 | "<fg=red>Migrations are not configured yet, run '<info>migrate:init</info>' first.</fg=red>" |
| 46 | 46 | ); |
@@ -58,14 +58,14 @@ discard block |
||
| 58 | 58 | */ |
| 59 | 59 | protected function verifyEnvironment(): bool |
| 60 | 60 | { |
| 61 | - if ($this->option('force') || $this->config->isSafe()) { |
|
| 61 | + if ($this->option('force') || $this->config->isSafe()){ |
|
| 62 | 62 | //Safe to run |
| 63 | 63 | return true; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | $this->writeln("<fg=red>Confirmation is required to run migrations!</fg=red>"); |
| 67 | 67 | |
| 68 | - if (!$this->askConfirmation()) { |
|
| 68 | + if (!$this->askConfirmation()){ |
|
| 69 | 69 | $this->writeln("<comment>Cancelling operation...</comment>"); |
| 70 | 70 | |
| 71 | 71 | return false; |
@@ -40,7 +40,8 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | protected function verifyConfigured(): bool |
| 42 | 42 | { |
| 43 | - if (!$this->migrator->isConfigured()) { |
|
| 43 | + if (!$this->migrator->isConfigured()) |
|
| 44 | + { |
|
| 44 | 45 | $this->writeln( |
| 45 | 46 | "<fg=red>Migrations are not configured yet, run '<info>migrate:init</info>' first.</fg=red>" |
| 46 | 47 | ); |
@@ -58,14 +59,16 @@ discard block |
||
| 58 | 59 | */ |
| 59 | 60 | protected function verifyEnvironment(): bool |
| 60 | 61 | { |
| 61 | - if ($this->option('force') || $this->config->isSafe()) { |
|
| 62 | + if ($this->option('force') || $this->config->isSafe()) |
|
| 63 | + { |
|
| 62 | 64 | //Safe to run |
| 63 | 65 | return true; |
| 64 | 66 | } |
| 65 | 67 | |
| 66 | 68 | $this->writeln("<fg=red>Confirmation is required to run migrations!</fg=red>"); |
| 67 | 69 | |
| 68 | - if (!$this->askConfirmation()) { |
|
| 70 | + if (!$this->askConfirmation()) |
|
| 71 | + { |
|
| 69 | 72 | $this->writeln("<comment>Cancelling operation...</comment>"); |
| 70 | 73 | |
| 71 | 74 | return false; |
@@ -23,14 +23,14 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | public function perform() |
| 25 | 25 | { |
| 26 | - if (!$this->verifyConfigured() || !$this->verifyEnvironment()) { |
|
| 26 | + if (!$this->verifyConfigured() || !$this->verifyEnvironment()){ |
|
| 27 | 27 | //Making sure we can safely migrate in this environment |
| 28 | 28 | return; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | $found = false; |
| 32 | 32 | $count = !$this->option('all') ? 1 : PHP_INT_MAX; |
| 33 | - while ($count > 0 && ($migration = $this->migrator->rollback())) { |
|
| 33 | + while ($count > 0 && ($migration = $this->migrator->rollback())){ |
|
| 34 | 34 | $found = true; |
| 35 | 35 | $count--; |
| 36 | 36 | $this->sprintf( |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | ); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - if (!$found) { |
|
| 42 | + if (!$found){ |
|
| 43 | 43 | $this->writeln("<fg=red>No executed migrations were found.</fg=red>"); |
| 44 | 44 | } |
| 45 | 45 | } |
@@ -23,14 +23,16 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | public function perform() |
| 25 | 25 | { |
| 26 | - if (!$this->verifyConfigured() || !$this->verifyEnvironment()) { |
|
| 26 | + if (!$this->verifyConfigured() || !$this->verifyEnvironment()) |
|
| 27 | + { |
|
| 27 | 28 | //Making sure we can safely migrate in this environment |
| 28 | 29 | return; |
| 29 | 30 | } |
| 30 | 31 | |
| 31 | 32 | $found = false; |
| 32 | 33 | $count = !$this->option('all') ? 1 : PHP_INT_MAX; |
| 33 | - while ($count > 0 && ($migration = $this->migrator->rollback())) { |
|
| 34 | + while ($count > 0 && ($migration = $this->migrator->rollback())) |
|
| 35 | + { |
|
| 34 | 36 | $found = true; |
| 35 | 37 | $count--; |
| 36 | 38 | $this->sprintf( |
@@ -39,7 +41,8 @@ discard block |
||
| 39 | 41 | ); |
| 40 | 42 | } |
| 41 | 43 | |
| 42 | - if (!$found) { |
|
| 44 | + if (!$found) |
|
| 45 | + { |
|
| 43 | 46 | $this->writeln("<fg=red>No executed migrations were found.</fg=red>"); |
| 44 | 47 | } |
| 45 | 48 | } |
@@ -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 | |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | $database = $dbal->database($this->option('database')); |
| 46 | 46 | $schema = $database->table($this->argument('table'))->getSchema(); |
| 47 | 47 | |
| 48 | - if (!$schema->exists()) { |
|
| 48 | + if (!$schema->exists()){ |
|
| 49 | 49 | throw new DBALException( |
| 50 | 50 | "Table {$database->getName()}.{$this->argument('table')} does not exists." |
| 51 | 51 | ); |
@@ -59,11 +59,11 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | $this->describeColumns($schema); |
| 61 | 61 | |
| 62 | - if (!empty($indexes = $schema->getIndexes())) { |
|
| 62 | + if (!empty($indexes = $schema->getIndexes())){ |
|
| 63 | 63 | $this->describeIndexes($database, $indexes); |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - if (!empty($foreignKeys = $schema->getForeignKeys())) { |
|
| 66 | + if (!empty($foreignKeys = $schema->getForeignKeys())){ |
|
| 67 | 67 | $this->describeForeignKeys($database, $foreignKeys); |
| 68 | 68 | } |
| 69 | 69 | |
@@ -83,10 +83,10 @@ discard block |
||
| 83 | 83 | 'Default Value:' |
| 84 | 84 | ]); |
| 85 | 85 | |
| 86 | - foreach ($schema->getColumns() as $column) { |
|
| 86 | + foreach ($schema->getColumns() as $column){ |
|
| 87 | 87 | $name = $column->getName(); |
| 88 | 88 | |
| 89 | - if (in_array($column->getName(), $schema->getPrimaryKeys())) { |
|
| 89 | + if (in_array($column->getName(), $schema->getPrimaryKeys())){ |
|
| 90 | 90 | $name = "<fg=magenta>{$name}</fg=magenta>"; |
| 91 | 91 | } |
| 92 | 92 | |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | ); |
| 116 | 116 | |
| 117 | 117 | $indexesTable = $this->table(['Name:', 'Type:', 'Columns:']); |
| 118 | - foreach ($indexes as $index) { |
|
| 118 | + foreach ($indexes as $index){ |
|
| 119 | 119 | $indexesTable->addRow([ |
| 120 | 120 | $index->getName(), |
| 121 | 121 | $index->isUnique() ? 'UNIQUE INDEX' : 'INDEX', |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | 'On Update:' |
| 147 | 147 | ]); |
| 148 | 148 | |
| 149 | - foreach ($foreignKeys as $reference) { |
|
| 149 | + foreach ($foreignKeys as $reference){ |
|
| 150 | 150 | $foreignTable->addRow([ |
| 151 | 151 | $reference->getName(), |
| 152 | 152 | join(', ', $reference->getColumns()), |
@@ -170,11 +170,11 @@ discard block |
||
| 170 | 170 | |
| 171 | 171 | $abstractType = $column->getAbstractType(); |
| 172 | 172 | |
| 173 | - if ($column->getSize()) { |
|
| 173 | + if ($column->getSize()){ |
|
| 174 | 174 | $type .= " ({$column->getSize()})"; |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | - if ($abstractType == 'decimal') { |
|
| 177 | + if ($abstractType == 'decimal'){ |
|
| 178 | 178 | $type .= " ({$column->getPrecision()}, {$column->getScale()})"; |
| 179 | 179 | } |
| 180 | 180 | |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | { |
| 190 | 190 | $abstractType = $column->getAbstractType(); |
| 191 | 191 | |
| 192 | - if (in_array($abstractType, ['primary', 'bigPrimary'])) { |
|
| 192 | + if (in_array($abstractType, ['primary', 'bigPrimary'])){ |
|
| 193 | 193 | $abstractType = "<fg=magenta>{$abstractType}</fg=magenta>"; |
| 194 | 194 | } |
| 195 | 195 | |
@@ -204,12 +204,12 @@ discard block |
||
| 204 | 204 | { |
| 205 | 205 | $defaultValue = $column->getDefaultValue(); |
| 206 | 206 | |
| 207 | - if ($defaultValue instanceof FragmentInterface) { |
|
| 207 | + if ($defaultValue instanceof FragmentInterface){ |
|
| 208 | 208 | $value = $defaultValue->compile(new QueryBindings(), $driver->getCompiler()); |
| 209 | 209 | return "<info>{$value}</info>"; |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | - if ($defaultValue instanceof \DateTimeInterface) { |
|
| 212 | + if ($defaultValue instanceof \DateTimeInterface){ |
|
| 213 | 213 | $defaultValue = $defaultValue->format('c'); |
| 214 | 214 | } |
| 215 | 215 | |
@@ -45,7 +45,8 @@ discard block |
||
| 45 | 45 | $database = $dbal->database($this->option('database')); |
| 46 | 46 | $schema = $database->table($this->argument('table'))->getSchema(); |
| 47 | 47 | |
| 48 | - if (!$schema->exists()) { |
|
| 48 | + if (!$schema->exists()) |
|
| 49 | + { |
|
| 49 | 50 | throw new DBALException( |
| 50 | 51 | "Table {$database->getName()}.{$this->argument('table')} does not exists." |
| 51 | 52 | ); |
@@ -59,11 +60,13 @@ discard block |
||
| 59 | 60 | |
| 60 | 61 | $this->describeColumns($schema); |
| 61 | 62 | |
| 62 | - if (!empty($indexes = $schema->getIndexes())) { |
|
| 63 | + if (!empty($indexes = $schema->getIndexes())) |
|
| 64 | + { |
|
| 63 | 65 | $this->describeIndexes($database, $indexes); |
| 64 | 66 | } |
| 65 | 67 | |
| 66 | - if (!empty($foreignKeys = $schema->getForeignKeys())) { |
|
| 68 | + if (!empty($foreignKeys = $schema->getForeignKeys())) |
|
| 69 | + { |
|
| 67 | 70 | $this->describeForeignKeys($database, $foreignKeys); |
| 68 | 71 | } |
| 69 | 72 | |
@@ -83,10 +86,12 @@ discard block |
||
| 83 | 86 | 'Default Value:' |
| 84 | 87 | ]); |
| 85 | 88 | |
| 86 | - foreach ($schema->getColumns() as $column) { |
|
| 89 | + foreach ($schema->getColumns() as $column) |
|
| 90 | + { |
|
| 87 | 91 | $name = $column->getName(); |
| 88 | 92 | |
| 89 | - if (in_array($column->getName(), $schema->getPrimaryKeys())) { |
|
| 93 | + if (in_array($column->getName(), $schema->getPrimaryKeys())) |
|
| 94 | + { |
|
| 90 | 95 | $name = "<fg=magenta>{$name}</fg=magenta>"; |
| 91 | 96 | } |
| 92 | 97 | |
@@ -115,7 +120,8 @@ discard block |
||
| 115 | 120 | ); |
| 116 | 121 | |
| 117 | 122 | $indexesTable = $this->table(['Name:', 'Type:', 'Columns:']); |
| 118 | - foreach ($indexes as $index) { |
|
| 123 | + foreach ($indexes as $index) |
|
| 124 | + { |
|
| 119 | 125 | $indexesTable->addRow([ |
| 120 | 126 | $index->getName(), |
| 121 | 127 | $index->isUnique() ? 'UNIQUE INDEX' : 'INDEX', |
@@ -146,7 +152,8 @@ discard block |
||
| 146 | 152 | 'On Update:' |
| 147 | 153 | ]); |
| 148 | 154 | |
| 149 | - foreach ($foreignKeys as $reference) { |
|
| 155 | + foreach ($foreignKeys as $reference) |
|
| 156 | + { |
|
| 150 | 157 | $foreignTable->addRow([ |
| 151 | 158 | $reference->getName(), |
| 152 | 159 | join(', ', $reference->getColumns()), |
@@ -170,11 +177,13 @@ discard block |
||
| 170 | 177 | |
| 171 | 178 | $abstractType = $column->getAbstractType(); |
| 172 | 179 | |
| 173 | - if ($column->getSize()) { |
|
| 180 | + if ($column->getSize()) |
|
| 181 | + { |
|
| 174 | 182 | $type .= " ({$column->getSize()})"; |
| 175 | 183 | } |
| 176 | 184 | |
| 177 | - if ($abstractType == 'decimal') { |
|
| 185 | + if ($abstractType == 'decimal') |
|
| 186 | + { |
|
| 178 | 187 | $type .= " ({$column->getPrecision()}, {$column->getScale()})"; |
| 179 | 188 | } |
| 180 | 189 | |
@@ -189,7 +198,8 @@ discard block |
||
| 189 | 198 | { |
| 190 | 199 | $abstractType = $column->getAbstractType(); |
| 191 | 200 | |
| 192 | - if (in_array($abstractType, ['primary', 'bigPrimary'])) { |
|
| 201 | + if (in_array($abstractType, ['primary', 'bigPrimary'])) |
|
| 202 | + { |
|
| 193 | 203 | $abstractType = "<fg=magenta>{$abstractType}</fg=magenta>"; |
| 194 | 204 | } |
| 195 | 205 | |
@@ -204,12 +214,14 @@ discard block |
||
| 204 | 214 | { |
| 205 | 215 | $defaultValue = $column->getDefaultValue(); |
| 206 | 216 | |
| 207 | - if ($defaultValue instanceof FragmentInterface) { |
|
| 217 | + if ($defaultValue instanceof FragmentInterface) |
|
| 218 | + { |
|
| 208 | 219 | $value = $defaultValue->compile(new QueryBindings(), $driver->getCompiler()); |
| 209 | 220 | return "<info>{$value}</info>"; |
| 210 | 221 | } |
| 211 | 222 | |
| 212 | - if ($defaultValue instanceof \DateTimeInterface) { |
|
| 223 | + if ($defaultValue instanceof \DateTimeInterface) |
|
| 224 | + { |
|
| 213 | 225 | $defaultValue = $defaultValue->format('c'); |
| 214 | 226 | } |
| 215 | 227 | |
@@ -43,18 +43,18 @@ discard block |
||
| 43 | 43 | string $destination, |
| 44 | 44 | string $mergeMode = self::FOLLOW, |
| 45 | 45 | int $mode = FilesInterface::READONLY |
| 46 | - ) { |
|
| 47 | - if (!$this->files->isFile($filename)) { |
|
| 46 | + ){ |
|
| 47 | + if (!$this->files->isFile($filename)){ |
|
| 48 | 48 | throw new PublishException("Given '{$filename}' is not valid file"); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - if ($this->files->exists($destination)) { |
|
| 52 | - if ($this->files->md5($destination) == $this->files->md5($filename)) { |
|
| 51 | + if ($this->files->exists($destination)){ |
|
| 52 | + if ($this->files->md5($destination) == $this->files->md5($filename)){ |
|
| 53 | 53 | //Nothing to do |
| 54 | 54 | return; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - if ($mergeMode == self::FOLLOW) { |
|
| 57 | + if ($mergeMode == self::FOLLOW){ |
|
| 58 | 58 | return; |
| 59 | 59 | } |
| 60 | 60 | } |
@@ -75,8 +75,8 @@ discard block |
||
| 75 | 75 | string $destination, |
| 76 | 76 | string $mergeMode = self::REPLACE, |
| 77 | 77 | int $mode = FilesInterface::READONLY |
| 78 | - ) { |
|
| 79 | - if (!$this->files->isDirectory($directory)) { |
|
| 78 | + ){ |
|
| 79 | + if (!$this->files->isDirectory($directory)){ |
|
| 80 | 80 | throw new PublishException("Given '{$directory}' is not valid directory"); |
| 81 | 81 | } |
| 82 | 82 | |
@@ -86,10 +86,10 @@ discard block |
||
| 86 | 86 | /** |
| 87 | 87 | * @var SplFileInfo $file |
| 88 | 88 | */ |
| 89 | - foreach ($finder->getIterator() as $file) { |
|
| 89 | + foreach ($finder->getIterator() as $file){ |
|
| 90 | 90 | $this->publish( |
| 91 | 91 | (string)$file, |
| 92 | - $destination . '/' . $file->getRelativePathname(), |
|
| 92 | + $destination.'/'.$file->getRelativePathname(), |
|
| 93 | 93 | $mergeMode, |
| 94 | 94 | $mode |
| 95 | 95 | ); |
@@ -44,17 +44,21 @@ discard block |
||
| 44 | 44 | string $mergeMode = self::FOLLOW, |
| 45 | 45 | int $mode = FilesInterface::READONLY |
| 46 | 46 | ) { |
| 47 | - if (!$this->files->isFile($filename)) { |
|
| 47 | + if (!$this->files->isFile($filename)) |
|
| 48 | + { |
|
| 48 | 49 | throw new PublishException("Given '{$filename}' is not valid file"); |
| 49 | 50 | } |
| 50 | 51 | |
| 51 | - if ($this->files->exists($destination)) { |
|
| 52 | - if ($this->files->md5($destination) == $this->files->md5($filename)) { |
|
| 52 | + if ($this->files->exists($destination)) |
|
| 53 | + { |
|
| 54 | + if ($this->files->md5($destination) == $this->files->md5($filename)) |
|
| 55 | + { |
|
| 53 | 56 | //Nothing to do |
| 54 | 57 | return; |
| 55 | 58 | } |
| 56 | 59 | |
| 57 | - if ($mergeMode == self::FOLLOW) { |
|
| 60 | + if ($mergeMode == self::FOLLOW) |
|
| 61 | + { |
|
| 58 | 62 | return; |
| 59 | 63 | } |
| 60 | 64 | } |
@@ -76,7 +80,8 @@ discard block |
||
| 76 | 80 | string $mergeMode = self::REPLACE, |
| 77 | 81 | int $mode = FilesInterface::READONLY |
| 78 | 82 | ) { |
| 79 | - if (!$this->files->isDirectory($directory)) { |
|
| 83 | + if (!$this->files->isDirectory($directory)) |
|
| 84 | + { |
|
| 80 | 85 | throw new PublishException("Given '{$directory}' is not valid directory"); |
| 81 | 86 | } |
| 82 | 87 | |
@@ -86,7 +91,8 @@ discard block |
||
| 86 | 91 | /** |
| 87 | 92 | * @var SplFileInfo $file |
| 88 | 93 | */ |
| 89 | - foreach ($finder->getIterator() as $file) { |
|
| 94 | + foreach ($finder->getIterator() as $file) |
|
| 95 | + { |
|
| 90 | 96 | $this->publish( |
| 91 | 97 | (string)$file, |
| 92 | 98 | $destination . '/' . $file->getRelativePathname(), |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | public function createPaginator(string $parameter, int $limit = 25): PaginatorInterface |
| 45 | 45 | { |
| 46 | - if (!$this->container->has(ServerRequestInterface::class)) { |
|
| 46 | + if (!$this->container->has(ServerRequestInterface::class)){ |
|
| 47 | 47 | throw new ScopeException("Unable to create paginator, no request scope found"); |
| 48 | 48 | } |
| 49 | 49 | /** |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | //Getting page number |
| 55 | 55 | $page = 0; |
| 56 | - if (!empty($query[$parameter]) && is_scalar($query[$parameter])) { |
|
| 56 | + if (!empty($query[$parameter]) && is_scalar($query[$parameter])){ |
|
| 57 | 57 | $page = (int)$query[$parameter]; |
| 58 | 58 | } |
| 59 | 59 | |
@@ -43,7 +43,8 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | public function createPaginator(string $parameter, int $limit = 25): PaginatorInterface |
| 45 | 45 | { |
| 46 | - if (!$this->container->has(ServerRequestInterface::class)) { |
|
| 46 | + if (!$this->container->has(ServerRequestInterface::class)) |
|
| 47 | + { |
|
| 47 | 48 | throw new ScopeException("Unable to create paginator, no request scope found"); |
| 48 | 49 | } |
| 49 | 50 | /** |
@@ -53,7 +54,8 @@ discard block |
||
| 53 | 54 | |
| 54 | 55 | //Getting page number |
| 55 | 56 | $page = 0; |
| 56 | - if (!empty($query[$parameter]) && is_scalar($query[$parameter])) { |
|
| 57 | + if (!empty($query[$parameter]) && is_scalar($query[$parameter])) |
|
| 58 | + { |
|
| 57 | 59 | $page = (int)$query[$parameter]; |
| 58 | 60 | } |
| 59 | 61 | |
@@ -68,7 +68,7 @@ |
||
| 68 | 68 | protected function fetchCookies(array $header) |
| 69 | 69 | { |
| 70 | 70 | $result = []; |
| 71 | - foreach ($header as $line) { |
|
| 71 | + foreach ($header as $line){ |
|
| 72 | 72 | $cookie = explode('=', $line); |
| 73 | 73 | $result[$cookie[0]] = rawurldecode(substr($cookie[1], 0, strpos($cookie[1], ';'))); |
| 74 | 74 | } |
@@ -68,7 +68,8 @@ |
||
| 68 | 68 | protected function fetchCookies(array $header) |
| 69 | 69 | { |
| 70 | 70 | $result = []; |
| 71 | - foreach ($header as $line) { |
|
| 71 | + foreach ($header as $line) |
|
| 72 | + { |
|
| 72 | 73 | $cookie = explode('=', $line); |
| 73 | 74 | $result[$cookie[0]] = rawurldecode(substr($cookie[1], 0, strpos($cookie[1], ';'))); |
| 74 | 75 | } |
@@ -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 | } |
| 27 | 27 | \ No newline at end of file |