@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | { |
| 62 | 62 | $migrationsService = $this->getMigrationService(); |
| 63 | 63 | |
| 64 | - $migrationDefinitions = $migrationsService->getMigrationsDefinitions($input->getOption('path')) ; |
|
| 64 | + $migrationDefinitions = $migrationsService->getMigrationsDefinitions($input->getOption('path')); |
|
| 65 | 65 | $migrations = $migrationsService->getMigrations(); |
| 66 | 66 | |
| 67 | 67 | if (!count($migrationDefinitions)) { |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | // filter away all migrations except 'to do' ones |
| 73 | 73 | $toExecute = array(); |
| 74 | - foreach($migrationDefinitions as $name => $migrationDefinition) { |
|
| 74 | + foreach ($migrationDefinitions as $name => $migrationDefinition) { |
|
| 75 | 75 | if (!isset($migrations[$name]) || (($migration = $migrations[$name]) && $migration->status == Migration::STATUS_TODO)) { |
| 76 | 76 | $toExecute[$name] = $migrationsService->parseMigrationDefinition($migrationDefinition); |
| 77 | 77 | } |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | |
| 89 | 89 | $data = array(); |
| 90 | 90 | $i = 1; |
| 91 | - foreach($toExecute as $name => $migrationDefinition) { |
|
| 91 | + foreach ($toExecute as $name => $migrationDefinition) { |
|
| 92 | 92 | $notes = ''; |
| 93 | 93 | if ($migrationDefinition->status != MigrationDefinition::STATUS_PARSED) { |
| 94 | 94 | $notes = '<error>' . $migrationDefinition->parsingError . '</error>'; |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | $output->writeln("=============================================\n"); |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - foreach($toExecute as $name => $migrationDefinition) { |
|
| 126 | + foreach ($toExecute as $name => $migrationDefinition) { |
|
| 127 | 127 | |
| 128 | 128 | // let's skip migrations that we know are invalid - user was warned and he decide to proceed anyway |
| 129 | 129 | if ($migrationDefinition->status == MigrationDefinition::STATUS_INVALID) { |
@@ -135,12 +135,12 @@ discard block |
||
| 135 | 135 | |
| 136 | 136 | try { |
| 137 | 137 | $migrationsService->executeMigration($migrationDefinition); |
| 138 | - } catch(\Exception $e) { |
|
| 138 | + } catch (\Exception $e) { |
|
| 139 | 139 | if ($input->getOption('ignore-failures')) { |
| 140 | - $output->writeln("\n<error>Migration failed!".$e->getMessage()."</error>\n"); |
|
| 140 | + $output->writeln("\n<error>Migration failed!" . $e->getMessage() . "</error>\n"); |
|
| 141 | 141 | continue; |
| 142 | 142 | } |
| 143 | - $output->writeln("\n<error>Migration aborted!".$e->getMessage()."</error>"); |
|
| 143 | + $output->writeln("\n<error>Migration aborted!" . $e->getMessage() . "</error>"); |
|
| 144 | 144 | return 1; |
| 145 | 145 | } |
| 146 | 146 | |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | { |
| 42 | 42 | $migrationsService = $this->getMigrationService(); |
| 43 | 43 | |
| 44 | - $migrationDefinitions = $migrationsService->getMigrationsDefinitions($input->getOption('path')) ; |
|
| 44 | + $migrationDefinitions = $migrationsService->getMigrationsDefinitions($input->getOption('path')); |
|
| 45 | 45 | $migrations = $migrationsService->getMigrations(); |
| 46 | 46 | |
| 47 | 47 | if (!count($migrationDefinitions) && !count($migrations)) { |
@@ -51,10 +51,10 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | // create a unique ist of all migrations (coming from db) and definitions (coming from disk) |
| 53 | 53 | $index = array(); |
| 54 | - foreach($migrationDefinitions as $migrationDefinition) { |
|
| 54 | + foreach ($migrationDefinitions as $migrationDefinition) { |
|
| 55 | 55 | $index[$migrationDefinition->name] = array('definition' => $migrationDefinition); |
| 56 | 56 | } |
| 57 | - foreach($migrations as $migration) { |
|
| 57 | + foreach ($migrations as $migration) { |
|
| 58 | 58 | if (isset($index[$migration->name])) { |
| 59 | 59 | $index[$migration->name]['migration'] = $migration; |
| 60 | 60 | } else { |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | { |
| 69 | 69 | $index[$migration->name]['definition'] = reset($migrationDefinitionCollection); |
| 70 | 70 | } |
| 71 | - } catch(\Exception $e) { |
|
| 71 | + } catch (\Exception $e) { |
|
| 72 | 72 | /// @todo one day we should be able to limit the kind of exceptions we have to catch here... |
| 73 | 73 | } |
| 74 | 74 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | $data = array(); |
| 82 | 82 | $i = 1; |
| 83 | - foreach($index as $name => $value) { |
|
| 83 | + foreach ($index as $name => $value) { |
|
| 84 | 84 | if (!isset($value['migration'])) { |
| 85 | 85 | $migrationDefinition = $migrationsService->parseMigrationDefinition($value['definition']); |
| 86 | 86 | $notes = ''; |
@@ -44,7 +44,7 @@ |
||
| 44 | 44 | */ |
| 45 | 45 | protected function execute(InputInterface $input, OutputInterface $output) |
| 46 | 46 | { |
| 47 | - if (/*! $input->getOption('add') &&*/ ! $input->getOption('delete')) { |
|
| 47 | + if (/*! $input->getOption('add') &&*/ !$input->getOption('delete')) { |
|
| 48 | 48 | throw new \InvalidArgumentException('You must specify whether you want to --delete the specified migration.'); |
| 49 | 49 | } |
| 50 | 50 | |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | $this->dsl['user_id'] = array($this->dsl['user_id']); |
| 133 | 133 | } |
| 134 | 134 | foreach ($this->dsl['user_id'] as $id) { |
| 135 | - array_push($usersToDelete,$userService->loadUser($id)); |
|
| 135 | + array_push($usersToDelete, $userService->loadUser($id)); |
|
| 136 | 136 | } |
| 137 | 137 | } |
| 138 | 138 | if (isset($this->dsl['email'])) { |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | $this->dsl['email'] = array($this->dsl['email']); |
| 141 | 141 | } |
| 142 | 142 | foreach ($this->dsl['email'] as $email) { |
| 143 | - $usersToDelete = array_merge($usersToDelete,$userService->loadUsersByEmail($email)); |
|
| 143 | + $usersToDelete = array_merge($usersToDelete, $userService->loadUsersByEmail($email)); |
|
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | 146 | if (isset($this->dsl['username'])) { |
@@ -148,11 +148,11 @@ discard block |
||
| 148 | 148 | $this->dsl['username'] = array($this->dsl['username']); |
| 149 | 149 | } |
| 150 | 150 | foreach ($this->dsl['username'] as $username) { |
| 151 | - array_push($usersToDelete,$userService->loadUserByLogin($username)); |
|
| 151 | + array_push($usersToDelete, $userService->loadUserByLogin($username)); |
|
| 152 | 152 | } |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | - foreach($usersToDelete as $user){ |
|
| 155 | + foreach ($usersToDelete as $user) { |
|
| 156 | 156 | $userService->deleteUser($user); |
| 157 | 157 | } |
| 158 | 158 | } |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | |
| 13 | 13 | protected $tagService; |
| 14 | 14 | |
| 15 | - public function __construct(TagsService $tagService=null) |
|
| 15 | + public function __construct(TagsService $tagService = null) |
|
| 16 | 16 | { |
| 17 | 17 | $this->tagService = $tagService; |
| 18 | 18 | } |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | $draft = $contentService->createContentDraft($contentInfo); |
| 128 | - $contentService->updateContent($draft->versionInfo,$contentUpdateStruct); |
|
| 128 | + $contentService->updateContent($draft->versionInfo, $contentUpdateStruct); |
|
| 129 | 129 | $content = $contentService->publishVersion($draft->versionInfo); |
| 130 | 130 | |
| 131 | 131 | if (array_key_exists('new_remote_id', $this->dsl)) { |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | |
| 159 | 159 | $contentService = $this->repository->getContentService(); |
| 160 | 160 | |
| 161 | - if (isset($this->dsl['object_id'])){ |
|
| 161 | + if (isset($this->dsl['object_id'])) { |
|
| 162 | 162 | if (!is_array($this->dsl['object_id'])) { |
| 163 | 163 | $this->dsl['object_id'] = array($this->dsl['object_id']); |
| 164 | 164 | } |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | * @param ContentCreateStruct $createStruct |
| 187 | 187 | * @param array $fields |
| 188 | 188 | */ |
| 189 | - protected function setFields(ContentCreateStruct &$createStruct, array $fields) |
|
| 189 | + protected function setFields(ContentCreateStruct & $createStruct, array $fields) |
|
| 190 | 190 | { |
| 191 | 191 | foreach ($fields as $field) { |
| 192 | 192 | // each $field is one key value pair |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | * @param ContentUpdateStruct $updateStruct |
| 215 | 215 | * @param array $fields |
| 216 | 216 | */ |
| 217 | - protected function setFieldsToUpdate(ContentUpdateStruct &$updateStruct, array $fields, ContentType $contentType) |
|
| 217 | + protected function setFieldsToUpdate(ContentUpdateStruct & $updateStruct, array $fields, ContentType $contentType) |
|
| 218 | 218 | { |
| 219 | 219 | foreach ($fields as $field) { |
| 220 | 220 | // each $field is one key value pair |
@@ -129,7 +129,7 @@ |
||
| 129 | 129 | $groupIds = array($groupIds); |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - foreach($groupIds as $groupId) { |
|
| 132 | + foreach ($groupIds as $groupId) { |
|
| 133 | 133 | $userGroup = $userService->loadUserGroup($groupId); |
| 134 | 134 | $userService->deleteUserGroup($userGroup); |
| 135 | 135 | } |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | !isset($match['parent_location_id']) && |
| 44 | 44 | !isset($match['parent_location_remote_id']) |
| 45 | 45 | ) { |
| 46 | - throw new \Exception('Either the ID or remote ID of a content, the ID or remote ID of a location or the id or remote ID |
|
| 46 | + throw new \Exception('Either the ID or remote ID of a content, the ID or remote ID of a location or the id or remote ID |
|
| 47 | 47 | of the parent location of the contents you want to create a new location are required to create a new location.'); |
| 48 | 48 | } |
| 49 | 49 | |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | if (empty($paths)) { |
| 58 | 58 | $paths = array(); |
| 59 | 59 | /** @var $bundle \Symfony\Component\HttpKernel\Bundle\BundleInterface */ |
| 60 | - foreach($this->kernel->getBundles() as $bundle) |
|
| 60 | + foreach ($this->kernel->getBundles() as $bundle) |
|
| 61 | 61 | { |
| 62 | 62 | $path = $bundle->getPath() . "/" . $this->versionDirectory; |
| 63 | 63 | if (is_dir($path)) { |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | $definitions = array(); |
| 70 | - foreach($paths as $path) { |
|
| 70 | + foreach ($paths as $path) { |
|
| 71 | 71 | if (is_file($path)) { |
| 72 | 72 | $definitions[basename($path)] = $returnFilename ? $path : new MigrationDefinition( |
| 73 | 73 | basename($path), |
@@ -85,8 +85,7 @@ |
||
| 85 | 85 | ); |
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | - } |
|
| 89 | - else { |
|
| 88 | + } else { |
|
| 90 | 89 | throw new \Exception("Path '$path' is neither a file nor directory"); |
| 91 | 90 | } |
| 92 | 91 | } |