@@ -29,7 +29,7 @@ |
||
29 | 29 | // Authenticate the user |
30 | 30 | $this->loginUser(); |
31 | 31 | |
32 | - foreach(array('identifier', 'content_type_group', 'name_pattern', 'name', 'attributes') as $key) { |
|
32 | + foreach (array('identifier', 'content_type_group', 'name_pattern', 'name', 'attributes') as $key) { |
|
33 | 33 | if (!array_key_exists($key, $this->dsl)) { |
34 | 34 | throw new \Exception("The '$key' key is missing in a content type creation definition"); |
35 | 35 | } |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | } |
178 | 178 | |
179 | 179 | $draft = $contentService->createContentDraft($contentInfo); |
180 | - $contentService->updateContent($draft->versionInfo,$contentUpdateStruct); |
|
180 | + $contentService->updateContent($draft->versionInfo, $contentUpdateStruct); |
|
181 | 181 | $content = $contentService->publishVersion($draft->versionInfo); |
182 | 182 | |
183 | 183 | if (array_key_exists('new_remote_id', $this->dsl)) { |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | * @param ContentCreateStruct $createStruct |
222 | 222 | * @param array $fields |
223 | 223 | */ |
224 | - protected function setFields(ContentCreateStruct &$createStruct, array $fields) |
|
224 | + protected function setFields(ContentCreateStruct & $createStruct, array $fields) |
|
225 | 225 | { |
226 | 226 | foreach ($fields as $field) { |
227 | 227 | // each $field is one key value pair |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | * @param ContentUpdateStruct $updateStruct |
249 | 249 | * @param array $fields |
250 | 250 | */ |
251 | - protected function setFieldsToUpdate(ContentUpdateStruct &$updateStruct, array $fields, ContentType $contentType) |
|
251 | + protected function setFieldsToUpdate(ContentUpdateStruct & $updateStruct, array $fields, ContentType $contentType) |
|
252 | 252 | { |
253 | 253 | foreach ($fields as $field) { |
254 | 254 | // each $field is one key value pair |
@@ -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 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | |
68 | 68 | // filter away all migrations except 'to do' ones |
69 | 69 | $toExecute = array(); |
70 | - foreach($migrationDefinitions as $name => $migrationDefinition) { |
|
70 | + foreach ($migrationDefinitions as $name => $migrationDefinition) { |
|
71 | 71 | if (!isset($migrations[$name]) || (($migration = $migrations[$name]) && $migration->status == Migration::STATUS_TODO)) { |
72 | 72 | $toExecute[$name] = $migrationsService->parseMigrationDefinition($migrationDefinition); |
73 | 73 | } |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | |
101 | 101 | $data = array(); |
102 | 102 | $i = 1; |
103 | - foreach($toExecute as $name => $migrationDefinition) { |
|
103 | + foreach ($toExecute as $name => $migrationDefinition) { |
|
104 | 104 | $notes = ''; |
105 | 105 | if ($migrationDefinition->status != MigrationDefinition::STATUS_PARSED) { |
106 | 106 | $notes = '<error>' . $migrationDefinition->parsingError . '</error>'; |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | $output->writeln("=============================================\n"); |
136 | 136 | } |
137 | 137 | |
138 | - foreach($toExecute as $name => $migrationDefinition) { |
|
138 | + foreach ($toExecute as $name => $migrationDefinition) { |
|
139 | 139 | |
140 | 140 | // let's skip migrations that we know are invalid - user was warned and he decided to proceed anyway |
141 | 141 | if ($migrationDefinition->status == MigrationDefinition::STATUS_INVALID) { |
@@ -147,12 +147,12 @@ discard block |
||
147 | 147 | |
148 | 148 | try { |
149 | 149 | $migrationsService->executeMigration($migrationDefinition); |
150 | - } catch(\Exception $e) { |
|
150 | + } catch (\Exception $e) { |
|
151 | 151 | if ($input->getOption('ignore-failures')) { |
152 | - $output->writeln("\n<error>Migration failed! Reason: ".$this->getFullExceptionMessage($e)."</error>\n"); |
|
152 | + $output->writeln("\n<error>Migration failed! Reason: " . $this->getFullExceptionMessage($e) . "</error>\n"); |
|
153 | 153 | continue; |
154 | 154 | } |
155 | - $output->writeln("\n<error>Migration aborted! Reason: ".$this->getFullExceptionMessage($e)."</error>"); |
|
155 | + $output->writeln("\n<error>Migration aborted! Reason: " . $this->getFullExceptionMessage($e) . "</error>"); |
|
156 | 156 | return 1; |
157 | 157 | } |
158 | 158 |
@@ -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 |