@@ -100,7 +100,7 @@ |
||
| 100 | 100 | // return unique contents |
| 101 | 101 | $objectState = $this->repository->getObjectStateService()->loadObjectState($objectStateId); |
| 102 | 102 | $objectStates[$objectState->id] = $objectState; |
| 103 | - } catch(NotFoundException $e) { |
|
| 103 | + } catch (NotFoundException $e) { |
|
| 104 | 104 | if (!$tolerateMisses) { |
| 105 | 105 | throw $e; |
| 106 | 106 | } |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | // return unique contents |
| 101 | 101 | $contentTypeGroup = $this->repository->getContentTypeService()->loadContentTypeGroup($contentTypeGroupId); |
| 102 | 102 | $contentTypeGroups[$contentTypeGroup->id] = $contentTypeGroup; |
| 103 | - } catch(NotFoundException $e) { |
|
| 103 | + } catch (NotFoundException $e) { |
|
| 104 | 104 | if (!$tolerateMisses) { |
| 105 | 105 | throw $e; |
| 106 | 106 | } |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | // return unique contents |
| 126 | 126 | $contentTypeGroup = $this->repository->getContentTypeService()->loadContentTypeGroupByIdentifier($contentTypeGroupIdentifier); |
| 127 | 127 | $contentTypeGroups[$contentTypeGroup->id] = $contentTypeGroup; |
| 128 | - } catch(NotFoundException $e) { |
|
| 128 | + } catch (NotFoundException $e) { |
|
| 129 | 129 | if (!$tolerateMisses) { |
| 130 | 130 | throw $e; |
| 131 | 131 | } |
@@ -37,11 +37,11 @@ discard block |
||
| 37 | 37 | $contents = array(); |
| 38 | 38 | switch ($key) { |
| 39 | 39 | case self::MATCH_CONTENT_ID: |
| 40 | - foreach($match as $contentId) { |
|
| 40 | + foreach ($match as $contentId) { |
|
| 41 | 41 | try { |
| 42 | 42 | $content = $this->repository->getContentService()->loadContent($contentId); |
| 43 | 43 | $contents[$content->id] = $content; |
| 44 | - } catch(NotFoundException $e) { |
|
| 44 | + } catch (NotFoundException $e) { |
|
| 45 | 45 | if (!$tolerateMisses) { |
| 46 | 46 | throw $e; |
| 47 | 47 | } |
@@ -49,11 +49,11 @@ discard block |
||
| 49 | 49 | } |
| 50 | 50 | break; |
| 51 | 51 | case self::MATCH_CONTENT_REMOTE_ID: |
| 52 | - foreach($match as $contentRemoteId) { |
|
| 52 | + foreach ($match as $contentRemoteId) { |
|
| 53 | 53 | try { |
| 54 | 54 | $content = $this->repository->getContentService()->loadContentByRemoteId($contentRemoteId); |
| 55 | 55 | $contents[$content->id] = $content; |
| 56 | - } catch(NotFoundException $e) { |
|
| 56 | + } catch (NotFoundException $e) { |
|
| 57 | 57 | if (!$tolerateMisses) { |
| 58 | 58 | throw $e; |
| 59 | 59 | } |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | namespace Kaliop\eZMigrationBundle\Core\Matcher; |
| 4 | 4 | |
| 5 | -use eZ\Publish\API\Repository\Exceptions\UnauthorizedException ; |
|
| 5 | +use eZ\Publish\API\Repository\Exceptions\UnauthorizedException; |
|
| 6 | 6 | use eZ\Publish\API\Repository\Repository; |
| 7 | 7 | use eZ\Publish\API\Repository\Values\Content\Content; |
| 8 | 8 | use \eZ\Publish\API\Repository\Values\Content\VersionInfo; |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | $versions = array(); |
| 58 | 58 | |
| 59 | 59 | $contentCollection = $this->contentMatcher->match($contentConditions, $sort, $offset, $limit, $tolerateMisses); |
| 60 | - foreach($contentCollection as $content) { |
|
| 60 | + foreach ($contentCollection as $content) { |
|
| 61 | 61 | $versions = array_merge($versions, $this->matchContentVersions($versionConditions, $content)); |
| 62 | 62 | } |
| 63 | 63 | |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | { |
| 180 | 180 | $versions = array(); |
| 181 | 181 | foreach ($this->findAllContentVersions($content) as $versionKey => $versionInfo) { |
| 182 | - foreach($values as $acceptedStatus) { |
|
| 182 | + foreach ($values as $acceptedStatus) { |
|
| 183 | 183 | if ($versionInfo->status == self::STATUS_MAP[$acceptedStatus]) { |
| 184 | 184 | $versions[$versionKey] = $versionInfo; |
| 185 | 185 | break; |
@@ -203,15 +203,15 @@ discard block |
||
| 203 | 203 | $contentVersionsCount = count($contentVersions); |
| 204 | 204 | $i = 0; |
| 205 | 205 | foreach ($contentVersions as $versionKey => $versionInfo) { |
| 206 | - foreach($values as $acceptedVersionNo) { |
|
| 207 | - if ($acceptedVersionNo > 0 ) { |
|
| 206 | + foreach ($values as $acceptedVersionNo) { |
|
| 207 | + if ($acceptedVersionNo > 0) { |
|
| 208 | 208 | if ($acceptedVersionNo == $versionInfo->versionNo) { |
| 209 | 209 | $versions[$versionKey] = $versionInfo; |
| 210 | 210 | break; |
| 211 | 211 | } |
| 212 | 212 | } else { |
| 213 | 213 | // negative $acceptedVersionNo means 'leave the last X versions', eg: -1 = leave the last version |
| 214 | - if ($i < $contentVersionsCount + $acceptedVersionNo) { |
|
| 214 | + if ($i < $contentVersionsCount + $acceptedVersionNo) { |
|
| 215 | 215 | $versions[$versionKey] = $versionInfo; |
| 216 | 216 | break; |
| 217 | 217 | |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | $contentVersions = $this->repository->getContentService()->loadVersions($content->contentInfo); |
| 234 | 234 | // different eZ kernels apparently sort versions in different order... |
| 235 | 235 | $sortedVersions = array(); |
| 236 | - foreach($contentVersions as $versionInfo) { |
|
| 236 | + foreach ($contentVersions as $versionInfo) { |
|
| 237 | 237 | $sortedVersions[$content->contentInfo->id . '/' . $versionInfo->versionNo] = $versionInfo; |
| 238 | 238 | } |
| 239 | 239 | ksort($sortedVersions); |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | // return unique contents |
| 109 | 109 | $contentType = $this->repository->getContentTypeService()->loadContentType($contentTypeId); |
| 110 | 110 | $contentTypes[$contentType->id] = $contentType; |
| 111 | - } catch(NotFoundException $e) { |
|
| 111 | + } catch (NotFoundException $e) { |
|
| 112 | 112 | if (!$tolerateMisses) { |
| 113 | 113 | throw $e; |
| 114 | 114 | } |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | // return unique contents |
| 134 | 134 | $contentType = $this->repository->getContentTypeService()->loadContentTypeByIdentifier($contentTypeIdentifier); |
| 135 | 135 | $contentTypes[$contentType->id] = $contentType; |
| 136 | - } catch(NotFoundException $e) { |
|
| 136 | + } catch (NotFoundException $e) { |
|
| 137 | 137 | if (!$tolerateMisses) { |
| 138 | 138 | throw $e; |
| 139 | 139 | } |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | // return unique contents |
| 158 | 158 | $contentType = $this->repository->getContentTypeService()->loadContentTypeByRemoteId($contentTypeRemoteId); |
| 159 | 159 | $contentTypes[$contentType->id] = $contentType; |
| 160 | - } catch(NotFoundException $e) { |
|
| 160 | + } catch (NotFoundException $e) { |
|
| 161 | 161 | if (!$tolerateMisses) { |
| 162 | 162 | throw $e; |
| 163 | 163 | } |
@@ -117,13 +117,13 @@ discard block |
||
| 117 | 117 | $dsl['mode'] = 'load'; |
| 118 | 118 | // be kind to users and allow them not to specify this explicitly |
| 119 | 119 | if (isset($dsl['references'])) { |
| 120 | - foreach($dsl['references'] as &$refDef) { |
|
| 120 | + foreach ($dsl['references'] as &$refDef) { |
|
| 121 | 121 | $refDef['overwrite'] = true; |
| 122 | 122 | } |
| 123 | 123 | } |
| 124 | 124 | $step = new MigrationStep($dsl['type'], $dsl, $context); |
| 125 | 125 | |
| 126 | - switch($dsl['type']) { |
|
| 126 | + switch ($dsl['type']) { |
|
| 127 | 127 | case 'content': |
| 128 | 128 | return $this->contentManager->execute($step); |
| 129 | 129 | case 'location': |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | return $this->matchConditions($values); |
| 155 | 155 | |
| 156 | 156 | default: |
| 157 | - throw new InvalidStepDefinitionException("Unknown until condition: '$key' when suspending a migration ".var_export($conditions, true)); |
|
| 157 | + throw new InvalidStepDefinitionException("Unknown until condition: '$key' when suspending a migration " . var_export($conditions, true)); |
|
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | 160 | } |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | public function endMigration(APIMigration $migration, $force = false) |
| 179 | 179 | { |
| 180 | 180 | if ($migration->status == APIMigration::STATUS_STARTED) { |
| 181 | - throw new \Exception($this->getEntityName($migration)." '{$migration->name}' can not be ended as its status is 'started'..."); |
|
| 181 | + throw new \Exception($this->getEntityName($migration) . " '{$migration->name}' can not be ended as its status is 'started'..."); |
|
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | $this->createTableIfNeeded(); |
@@ -205,13 +205,13 @@ discard block |
||
| 205 | 205 | if (!is_array($existingMigrationData)) { |
| 206 | 206 | // commit to release the lock |
| 207 | 207 | $conn->commit(); |
| 208 | - throw new \Exception($this->getEntityName($migration)." '{$migration->name}' can not be ended as it is not found"); |
|
| 208 | + throw new \Exception($this->getEntityName($migration) . " '{$migration->name}' can not be ended as it is not found"); |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | if (($existingMigrationData['status'] != APIMigration::STATUS_STARTED) && !$force) { |
| 212 | 212 | // commit to release the lock |
| 213 | 213 | $conn->commit(); |
| 214 | - throw new \Exception($this->getEntityName($migration)." '{$migration->name}' can not be ended as it is not executing"); |
|
| 214 | + throw new \Exception($this->getEntityName($migration) . " '{$migration->name}' can not be ended as it is not executing"); |
|
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | $conn->update( |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | if (!is_array($existingMigrationData)) { |
| 367 | 367 | // commit immediately, to release the lock and avoid deadlocks |
| 368 | 368 | $conn->commit(); |
| 369 | - throw new \Exception($this->getEntityName($migration)." '{$migration->name}' can not be resumed as it is not found"); |
|
| 369 | + throw new \Exception($this->getEntityName($migration) . " '{$migration->name}' can not be resumed as it is not found"); |
|
| 370 | 370 | } |
| 371 | 371 | |
| 372 | 372 | // migration exists |
@@ -375,7 +375,7 @@ discard block |
||
| 375 | 375 | if ($existingMigrationData['status'] != APIMigration::STATUS_SUSPENDED) { |
| 376 | 376 | // commit to release the lock |
| 377 | 377 | $conn->commit(); |
| 378 | - throw new \Exception($this->getEntityName($migration)." '{$migration->name}' can not be resumed as it is not suspended"); |
|
| 378 | + throw new \Exception($this->getEntityName($migration) . " '{$migration->name}' can not be resumed as it is not suspended"); |
|
| 379 | 379 | } |
| 380 | 380 | |
| 381 | 381 | $migration = new APIMigration( |
@@ -434,7 +434,7 @@ discard block |
||
| 434 | 434 | foreach ($schema->toSql($dbPlatform) as $sql) { |
| 435 | 435 | try { |
| 436 | 436 | $this->dbHandler->exec($sql); |
| 437 | - } catch(QueryException $e) { |
|
| 437 | + } catch (QueryException $e) { |
|
| 438 | 438 | // work around limitations in both Mysql and Doctrine |
| 439 | 439 | // @see https://github.com/kaliop-uk/ezmigrationbundle/issues/176 |
| 440 | 440 | if (strpos($e->getMessage(), '1071 Specified key was too long; max key length is 767 bytes') !== false && |
@@ -123,7 +123,7 @@ |
||
| 123 | 123 | foreach ($schema->toSql($dbPlatform) as $sql) { |
| 124 | 124 | try { |
| 125 | 125 | $this->dbHandler->exec($sql); |
| 126 | - } catch(QueryException $e) { |
|
| 126 | + } catch (QueryException $e) { |
|
| 127 | 127 | // work around limitations in both Mysql and Doctrine |
| 128 | 128 | // @see https://github.com/kaliop-uk/ezmigrationbundle/issues/176 |
| 129 | 129 | if (strpos($e->getMessage(), '1071 Specified key was too long; max key length is 767 bytes') !== false && |
@@ -53,7 +53,7 @@ |
||
| 53 | 53 | */ |
| 54 | 54 | protected function injectTableCreationOptions(Table $table) |
| 55 | 55 | { |
| 56 | - foreach($this->tableCreationOptions as $key => $value) { |
|
| 56 | + foreach ($this->tableCreationOptions as $key => $value) { |
|
| 57 | 57 | $table->addOption($key, $value); |
| 58 | 58 | } |
| 59 | 59 | } |