@@ -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 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | // q: what if we get a scalar result but we expect an array/collection ? |
37 | 37 | if (is_array($results) || $results instanceof AbstractCollection) { |
38 | 38 | $expectedResultsCount = $this->expectedResultsCount($step); |
39 | - switch($expectedResultsCount) { |
|
39 | + switch ($expectedResultsCount) { |
|
40 | 40 | case self::$EXPECT_UNSPECIFIED: |
41 | 41 | case self::$EXPECT_ANY: |
42 | 42 | break; |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | */ |
62 | 62 | protected function expectedResultsType($step) |
63 | 63 | { |
64 | - switch($this->expectedResultsCount($step)) { |
|
64 | + switch ($this->expectedResultsCount($step)) { |
|
65 | 65 | case 1: |
66 | 66 | return self::$RESULT_TYPE_SINGLE; |
67 | 67 | case 0: |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | |
104 | 104 | // BC |
105 | 105 | if (isset($step->dsl['references_type'])) { |
106 | - switch($step->dsl['references_type']) { |
|
106 | + switch ($step->dsl['references_type']) { |
|
107 | 107 | case 'array': |
108 | 108 | return self::$EXPECT_ANY; |
109 | 109 | case 'scalar': |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | */ |
129 | 129 | protected function hasNonScalarReferences($referencesDefinition) |
130 | 130 | { |
131 | - foreach($referencesDefinition as $referenceDefinition) { |
|
131 | + foreach ($referencesDefinition as $referenceDefinition) { |
|
132 | 132 | if (!$this->isScalarReference($referenceDefinition)) |
133 | 133 | { |
134 | 134 | return true; |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | |
226 | 226 | $multivalued = ($this->expectedResultsType($step) == self::$RESULT_TYPE_MULTIPLE); |
227 | 227 | |
228 | - if ($item instanceof AbstractCollection || is_array($item)) { |
|
228 | + if ($item instanceof AbstractCollection || is_array($item)) { |
|
229 | 229 | $items = $item; |
230 | 230 | } else { |
231 | 231 | $items = array($item); |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | { |
269 | 269 | // allow setting *some* refs even when we have 0 or N matches |
270 | 270 | foreach ($referencesDefinition as $key => $reference) { |
271 | - switch($reference['attribute']) { |
|
271 | + switch ($reference['attribute']) { |
|
272 | 272 | |
273 | 273 | case 'count': |
274 | 274 | $value = count($entity); |
@@ -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 | } |