@@ -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 | } |
@@ -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 | } |
@@ -46,7 +46,7 @@ |
||
46 | 46 | if (is_string($key) && is_string($value)) { |
47 | 47 | return array('identifier' => $key, 'attribute' => $value); |
48 | 48 | } |
49 | - if (!is_array($value) || !isset($value['identifier']) || ! isset($value['attribute'])) { |
|
49 | + if (!is_array($value) || !isset($value['identifier']) || !isset($value['attribute'])) { |
|
50 | 50 | throw new InvalidStepDefinitionException("Invalid reference definition for reference number $key"); |
51 | 51 | } |
52 | 52 | return $value; |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | // q2: why not just check for Countable interface instead of AbstractCollection? Or at least allow ArrayIterators and ObjectIterators |
38 | 38 | if (is_array($results) || $results instanceof AbstractCollection) { |
39 | 39 | $expectedResultsCount = $this->expectedResultsCount($step); |
40 | - switch($expectedResultsCount) { |
|
40 | + switch ($expectedResultsCount) { |
|
41 | 41 | case self::$EXPECT_UNSPECIFIED: |
42 | 42 | case self::$EXPECT_ANY: |
43 | 43 | break; |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | */ |
63 | 63 | protected function expectedResultsType($step) |
64 | 64 | { |
65 | - switch($this->expectedResultsCount($step)) { |
|
65 | + switch ($this->expectedResultsCount($step)) { |
|
66 | 66 | case 1: |
67 | 67 | return self::$RESULT_TYPE_SINGLE; |
68 | 68 | case 0: |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | |
105 | 105 | // BC |
106 | 106 | if (isset($step->dsl['references_type'])) { |
107 | - switch($step->dsl['references_type']) { |
|
107 | + switch ($step->dsl['references_type']) { |
|
108 | 108 | case 'array': |
109 | 109 | return self::$EXPECT_ANY; |
110 | 110 | case 'scalar': |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | */ |
131 | 131 | protected function hasNonScalarReferences($referencesDefinition) |
132 | 132 | { |
133 | - foreach($referencesDefinition as $key => $referenceDefinition) { |
|
133 | + foreach ($referencesDefinition as $key => $referenceDefinition) { |
|
134 | 134 | $referenceDefinition = $this->parseReferenceDefinition($key, $referenceDefinition); |
135 | 135 | if (!$this->isScalarReference($referenceDefinition)) |
136 | 136 | { |