@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | */ |
50 | 50 | protected function execute(InputInterface $input, OutputInterface $output) |
51 | 51 | { |
52 | - if (! $input->getOption('add') && ! $input->getOption('delete')) { |
|
52 | + if (!$input->getOption('add') && !$input->getOption('delete')) { |
|
53 | 53 | throw new \InvalidArgumentException('You must specify whether you want to --add or --delete the specified migration.'); |
54 | 54 | } |
55 | 55 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | throw new \InvalidArgumentException(sprintf('The path "%s" does not correspond to any migration definition.', $migrationNameOrPath)); |
80 | 80 | } |
81 | 81 | |
82 | - foreach($migrationDefinitionCollection as $migrationDefinition) { |
|
82 | + foreach ($migrationDefinitionCollection as $migrationDefinition) { |
|
83 | 83 | $migrationName = basename($migrationDefinition->path); |
84 | 84 | |
85 | 85 | $migration = $migrationService->getMigration($migrationNameOrPath); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | ); |
117 | 117 | try { |
118 | 118 | $conn->insert($this->migrationsTableName, $this->migrationToArray($migration)); |
119 | - } catch(UniqueConstraintViolationException $e) { |
|
119 | + } catch (UniqueConstraintViolationException $e) { |
|
120 | 120 | throw new \Exception("Migration '{$migrationDefinition->name}' already exists"); |
121 | 121 | } |
122 | 122 | |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | $t->addColumn('execution_error', 'string', array('length' => 4000, 'notnull' => false)); |
312 | 312 | $t->setPrimaryKey(array('migration')); |
313 | 313 | |
314 | - foreach($schema->toSql($dbPlatform) as $sql) { |
|
314 | + foreach ($schema->toSql($dbPlatform) as $sql) { |
|
315 | 315 | $this->dbHandler->exec($sql); |
316 | 316 | } |
317 | 317 | } |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | { |
327 | 327 | /** @var \Doctrine\DBAL\Schema\AbstractSchemaManager $sm */ |
328 | 328 | $sm = $this->dbHandler->getConnection()->getSchemaManager(); |
329 | - foreach($sm->listTables() as $table) { |
|
329 | + foreach ($sm->listTables() as $table) { |
|
330 | 330 | if ($table->getName() == $tableName) { |
331 | 331 | return true; |
332 | 332 | } |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // try to load autoloade both when extension is top-level project and when it is installed as part of a working eZPUblish |
4 | -if (!file_exists($file = __DIR__.'/../vendor/autoload.php') && !file_exists($file = __DIR__.'/../../../../vendor/autoload.php')) { |
|
4 | +if (!file_exists($file = __DIR__ . '/../vendor/autoload.php') && !file_exists($file = __DIR__ . '/../../../../vendor/autoload.php')) { |
|
5 | 5 | throw new \RuntimeException('Install the dependencies to run the test suite.'); |
6 | 6 | } |
7 | 7 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -include_once(__DIR__.'/CommandTest.php'); |
|
3 | +include_once(__DIR__ . '/CommandTest.php'); |
|
4 | 4 | |
5 | 5 | use Symfony\Component\Console\Input\ArrayInput; |
6 | 6 | |
@@ -64,6 +64,6 @@ discard block |
||
64 | 64 | $exitCode = $this->app->run($input, $this->output); |
65 | 65 | $output = $this->output->fetch(); |
66 | 66 | $this->assertSame(0, $exitCode); |
67 | - $this->assertRegExp('?\| ' . basename($filePath) . ' +\| not executed \|?', $output ); |
|
67 | + $this->assertRegExp('?\| ' . basename($filePath) . ' +\| not executed \|?', $output); |
|
68 | 68 | } |
69 | 69 | } |
@@ -10,6 +10,6 @@ |
||
10 | 10 | |
11 | 11 | public function setUp() |
12 | 12 | { |
13 | - $this->connection = DriverManager::getConnection( array( 'driver' => 'pdo_sqlite', 'memory' => true ) ); |
|
13 | + $this->connection = DriverManager::getConnection(array('driver' => 'pdo_sqlite', 'memory' => true)); |
|
14 | 14 | } |
15 | 15 | } |
@@ -28,7 +28,7 @@ |
||
28 | 28 | |
29 | 29 | protected function tearDown() |
30 | 30 | { |
31 | - foreach($this->leftovers as $file) { |
|
31 | + foreach ($this->leftovers as $file) { |
|
32 | 32 | unlink($file); |
33 | 33 | } |
34 | 34 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -include_once(__DIR__.'/CommandTest.php'); |
|
3 | +include_once(__DIR__ . '/CommandTest.php'); |
|
4 | 4 | |
5 | 5 | use Symfony\Component\Console\Input\ArrayInput; |
6 | 6 | |
@@ -81,13 +81,13 @@ discard block |
||
81 | 81 | |
82 | 82 | public function goodDSLProvider() |
83 | 83 | { |
84 | - $dslDir = $this->dslDir.'/good'; |
|
85 | - if(!is_dir($dslDir)) { |
|
84 | + $dslDir = $this->dslDir . '/good'; |
|
85 | + if (!is_dir($dslDir)) { |
|
86 | 86 | return array(); |
87 | 87 | } |
88 | 88 | |
89 | 89 | $out = array(); |
90 | - foreach(scandir($dslDir) as $fileName) { |
|
90 | + foreach (scandir($dslDir) as $fileName) { |
|
91 | 91 | $filePath = $dslDir . '/' . $fileName; |
92 | 92 | if (is_file($filePath)) { |
93 | 93 | $out[] = array($filePath); |
@@ -98,13 +98,13 @@ discard block |
||
98 | 98 | |
99 | 99 | public function badDSLProvider() |
100 | 100 | { |
101 | - $dslDir = $this->dslDir.'/bad'; |
|
102 | - if(!is_dir($dslDir)) { |
|
101 | + $dslDir = $this->dslDir . '/bad'; |
|
102 | + if (!is_dir($dslDir)) { |
|
103 | 103 | return array(); |
104 | 104 | } |
105 | 105 | |
106 | 106 | $out = array(); |
107 | - foreach(scandir($dslDir) as $fileName) { |
|
107 | + foreach (scandir($dslDir) as $fileName) { |
|
108 | 108 | $filePath = $dslDir . '/' . $fileName; |
109 | 109 | if (is_file($filePath)) { |
110 | 110 | $out[] = array($filePath); |
@@ -180,7 +180,7 @@ |
||
180 | 180 | } |
181 | 181 | |
182 | 182 | $draft = $contentService->createContentDraft($contentInfo); |
183 | - $contentService->updateContent($draft->versionInfo,$contentUpdateStruct); |
|
183 | + $contentService->updateContent($draft->versionInfo, $contentUpdateStruct); |
|
184 | 184 | $content = $contentService->publishVersion($draft->versionInfo); |
185 | 185 | |
186 | 186 | if (array_key_exists('new_remote_id', $this->dsl)) { |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | |
46 | 46 | public function addExecutor(ExecutorInterface $executor) |
47 | 47 | { |
48 | - foreach($executor->supportedTypes() as $type) { |
|
48 | + foreach ($executor->supportedTypes() as $type) { |
|
49 | 49 | $this->executors[$type] = $executor; |
50 | 50 | } |
51 | 51 | } |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | { |
61 | 61 | // we try to be flexible in file types we support, and the same time avoid loading all files in a directory |
62 | 62 | $handledDefinitions = array(); |
63 | - foreach($this->loader->listAvailableDefinitions($paths) as $migrationName => $definitionPath) { |
|
64 | - foreach($this->DefinitionParsers as $definitionParser) { |
|
63 | + foreach ($this->loader->listAvailableDefinitions($paths) as $migrationName => $definitionPath) { |
|
64 | + foreach ($this->DefinitionParsers as $definitionParser) { |
|
65 | 65 | if ($definitionParser->supports($migrationName)) { |
66 | 66 | $handledDefinitions[] = $definitionPath; |
67 | 67 | } |
@@ -122,13 +122,13 @@ discard block |
||
122 | 122 | */ |
123 | 123 | public function parseMigrationDefinition(MigrationDefinition $migrationDefinition) |
124 | 124 | { |
125 | - foreach($this->DefinitionParsers as $definitionParser) { |
|
125 | + foreach ($this->DefinitionParsers as $definitionParser) { |
|
126 | 126 | if ($definitionParser->supports($migrationDefinition->name)) { |
127 | 127 | // parse the source file |
128 | 128 | $migrationDefinition = $definitionParser->parseMigrationDefinition($migrationDefinition); |
129 | 129 | |
130 | 130 | // and make sure we know how to handle all steps |
131 | - foreach($migrationDefinition->steps as $step) { |
|
131 | + foreach ($migrationDefinition->steps as $step) { |
|
132 | 132 | if (!isset($this->executors[$step->type])) { |
133 | 133 | return new MigrationDefinition( |
134 | 134 | $migrationDefinition->name, |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | |
173 | 173 | $i = 1; |
174 | 174 | |
175 | - foreach($migrationDefinition->steps as $step) { |
|
175 | + foreach ($migrationDefinition->steps as $step) { |
|
176 | 176 | // we validated the fact that we have a good executor at parsing time |
177 | 177 | $executor = $this->executors[$step->type]; |
178 | 178 | $executor->execute($step); |
@@ -193,16 +193,16 @@ discard block |
||
193 | 193 | |
194 | 194 | try { |
195 | 195 | $this->repository->commit(); |
196 | - } catch(\RuntimeException $e) { |
|
196 | + } catch (\RuntimeException $e) { |
|
197 | 197 | // at present time, the ez5 repo does not support nested commits. So if some migration step has committed |
198 | 198 | // already, we get an exception a this point. Extremely poor design, but what can we do ? |
199 | 199 | /// @todo log warning |
200 | 200 | } |
201 | 201 | |
202 | - } catch(\Exception $e) { |
|
202 | + } catch (\Exception $e) { |
|
203 | 203 | try { |
204 | 204 | $this->repository->rollBack(); |
205 | - } catch(\RuntimeException $e2) { |
|
205 | + } catch (\RuntimeException $e2) { |
|
206 | 206 | // at present time, the ez5 repo does not support nested commits. So if some migration step has committed |
207 | 207 | // already, we get an exception a this point. Extremely poor design, but what can we do ? |
208 | 208 | /// @todo log error |