@@ -80,7 +80,7 @@  | 
                                                    ||
| 80 | 80 | }  | 
                                                        
| 81 | 81 | |
| 82 | 82 | /**  | 
                                                        
| 83 | - * @return string[]  | 
                                                        |
| 83 | + * @return integer[]  | 
                                                        |
| 84 | 84 | */  | 
                                                        
| 85 | 85 | public function listExecutors()  | 
                                                        
| 86 | 86 |      { | 
                                                        
@@ -259,7 +259,7 @@ discard block  | 
                                                    ||
| 259 | 259 | }  | 
                                                        
| 260 | 260 | |
| 261 | 261 |          if ($migrationDefinition->status == MigrationDefinition::STATUS_INVALID) { | 
                                                        
| 262 | -            throw new \Exception("Can not execute " . $this->getEntityName($migrationDefinition). " '{$migrationDefinition->name}': {$migrationDefinition->parsingError}"); | 
                                                        |
| 262 | +            throw new \Exception("Can not execute " . $this->getEntityName($migrationDefinition) . " '{$migrationDefinition->name}': {$migrationDefinition->parsingError}"); | 
                                                        |
| 263 | 263 | }  | 
                                                        
| 264 | 264 | |
| 265 | 265 | /// @todo add support for setting in $migrationContext a userContentType ?  | 
                                                        
@@ -293,7 +293,7 @@ discard block  | 
                                                    ||
| 293 | 293 | |
| 294 | 294 |          try { | 
                                                        
| 295 | 295 | |
| 296 | - $i = $stepOffset+1;  | 
                                                        |
| 296 | + $i = $stepOffset + 1;  | 
                                                        |
| 297 | 297 | $finalStatus = Migration::STATUS_DONE;  | 
                                                        
| 298 | 298 | $finalMessage = null;  | 
                                                        
| 299 | 299 | |
@@ -418,12 +418,12 @@ discard block  | 
                                                    ||
| 418 | 418 | public function resumeMigration(Migration $migration, $useTransaction = true)  | 
                                                        
| 419 | 419 |      { | 
                                                        
| 420 | 420 |          if ($migration->status != Migration::STATUS_SUSPENDED) { | 
                                                        
| 421 | -            throw new \Exception("Can not resume ".$this->getEntityName($migration)." '{$migration->name}': it is not in suspended status"); | 
                                                        |
| 421 | +            throw new \Exception("Can not resume " . $this->getEntityName($migration) . " '{$migration->name}': it is not in suspended status"); | 
                                                        |
| 422 | 422 | }  | 
                                                        
| 423 | 423 | |
| 424 | 424 | $migrationDefinitions = $this->getMigrationsDefinitions(array($migration->path));  | 
                                                        
| 425 | 425 |          if (!count($migrationDefinitions)) { | 
                                                        
| 426 | -            throw new \Exception("Can not resume ".$this->getEntityName($migration)." '{$migration->name}': its definition is missing"); | 
                                                        |
| 426 | +            throw new \Exception("Can not resume " . $this->getEntityName($migration) . " '{$migration->name}': its definition is missing"); | 
                                                        |
| 427 | 427 | }  | 
                                                        
| 428 | 428 | |
| 429 | 429 | $defs = $migrationDefinitions->getArrayCopy();  | 
                                                        
@@ -431,18 +431,18 @@ discard block  | 
                                                    ||
| 431 | 431 | |
| 432 | 432 | $migrationDefinition = $this->parseMigrationDefinition($migrationDefinition);  | 
                                                        
| 433 | 433 |          if ($migrationDefinition->status == MigrationDefinition::STATUS_INVALID) { | 
                                                        
| 434 | -            throw new \Exception("Can not resume ".$this->getEntityName($migration)." '{$migration->name}': {$migrationDefinition->parsingError}"); | 
                                                        |
| 434 | +            throw new \Exception("Can not resume " . $this->getEntityName($migration) . " '{$migration->name}': {$migrationDefinition->parsingError}"); | 
                                                        |
| 435 | 435 | }  | 
                                                        
| 436 | 436 | |
| 437 | 437 | // restore context  | 
                                                        
| 438 | 438 | $this->contextHandler->restoreCurrentContext($migration->name);  | 
                                                        
| 439 | 439 | |
| 440 | 440 |          if (!isset($this->migrationContext[$migration->name])) { | 
                                                        
| 441 | -            throw new \Exception("Can not resume ".$this->getEntityName($migration)." '{$migration->name}': the stored context is missing"); | 
                                                        |
| 441 | +            throw new \Exception("Can not resume " . $this->getEntityName($migration) . " '{$migration->name}': the stored context is missing"); | 
                                                        |
| 442 | 442 | }  | 
                                                        
| 443 | 443 | $restoredContext = $this->migrationContext[$migration->name];  | 
                                                        
| 444 | -        if (!is_array($restoredContext) || !isset($restoredContext['context']) || !isset($restoredContext['step'] )) { | 
                                                        |
| 445 | -            throw new \Exception("Can not resume ".$this->getEntityName($migration)." '{$migration->name}': the stored context is invalid"); | 
                                                        |
| 444 | +        if (!is_array($restoredContext) || !isset($restoredContext['context']) || !isset($restoredContext['step'])) { | 
                                                        |
| 445 | +            throw new \Exception("Can not resume " . $this->getEntityName($migration) . " '{$migration->name}': the stored context is invalid"); | 
                                                        |
| 446 | 446 | }  | 
                                                        
| 447 | 447 | |
| 448 | 448 | // update migration status  | 
                                                        
@@ -150,7 +150,7 @@ discard block  | 
                                                    ||
| 150 | 150 | }  | 
                                                        
| 151 | 151 | |
| 152 | 152 | // allow to generate migrations for many entities  | 
                                                        
| 153 | -        if (strpos($matchValue, ',') !== false ) { | 
                                                        |
| 153 | +        if (strpos($matchValue, ',') !== false) { | 
                                                        |
| 154 | 154 |              $matchValue = explode(',', $matchValue); | 
                                                        
| 155 | 155 | }  | 
                                                        
| 156 | 156 | |
@@ -260,7 +260,7 @@ discard block  | 
                                                    ||
| 260 | 260 |      { | 
                                                        
| 261 | 261 | $migrationService = $this->getMigrationService();  | 
                                                        
| 262 | 262 | $executors = $migrationService->listExecutors();  | 
                                                        
| 263 | -        foreach($executors as $key => $name) { | 
                                                        |
| 263 | +        foreach ($executors as $key => $name) { | 
                                                        |
| 264 | 264 | $executor = $migrationService->getExecutor($name);  | 
                                                        
| 265 | 265 |              if (!$executor instanceof MigrationGeneratorInterface) { | 
                                                        
| 266 | 266 | unset($executors[$key]);  | 
                                                        
@@ -559,7 +559,7 @@  | 
                                                    ||
| 559 | 559 | $locations = $locationService->loadLocations($content->contentInfo);  | 
                                                        
| 560 | 560 |                      if (count($locations) > 1) { | 
                                                        
| 561 | 561 | $otherParentLocations = array();  | 
                                                        
| 562 | -                        foreach($locations as $otherLocation) { | 
                                                        |
| 562 | +                        foreach ($locations as $otherLocation) { | 
                                                        |
| 563 | 563 |                              if ($otherLocation->id != $location->id) { | 
                                                        
| 564 | 564 | $otherParentLocations[] = $otherLocation->parentLocationId;  | 
                                                        
| 565 | 565 | }  | 
                                                        
@@ -648,7 +648,7 @@  | 
                                                    ||
| 648 | 648 | * @param string $contentTypeIdentifier  | 
                                                        
| 649 | 649 | * @param array $context  | 
                                                        
| 650 | 650 | * @throws \InvalidArgumentException  | 
                                                        
| 651 | - * @return mixed  | 
                                                        |
| 651 | + * @return \Kaliop\eZMigrationBundle\API\Value\MigrationStep  | 
                                                        |
| 652 | 652 | */  | 
                                                        
| 653 | 653 | protected function getFieldValue($value, FieldDefinition $fieldDefinition, $contentTypeIdentifier, array $context = array())  | 
                                                        
| 654 | 654 |      { | 
                                                        
@@ -4,7 +4,6 @@  | 
                                                    ||
| 4 | 4 | |
| 5 | 5 | use eZ\Publish\API\Repository\Values\ContentType\ContentType;  | 
                                                        
| 6 | 6 | use eZ\Publish\API\Repository\Values\ContentType\FieldDefinition;  | 
                                                        
| 7 | -use eZ\Publish\API\Repository\Values\Content\Location;  | 
                                                        |
| 8 | 7 | use eZ\Publish\API\Repository\Values\Content\Content;  | 
                                                        
| 9 | 8 | use eZ\Publish\API\Repository\Values\Content\ContentCreateStruct;  | 
                                                        
| 10 | 9 | use eZ\Publish\API\Repository\Values\Content\ContentUpdateStruct;  | 
                                                        
@@ -33,7 +33,7 @@  | 
                                                    ||
| 33 | 33 | public function sortField2Hash($value)  | 
                                                        
| 34 | 34 |      { | 
                                                        
| 35 | 35 |          $ref = new \ReflectionClass('eZ\Publish\API\Repository\Values\Content\Location'); | 
                                                        
| 36 | -        foreach($ref->getConstants() as $key => $val) { | 
                                                        |
| 36 | +        foreach ($ref->getConstants() as $key => $val) { | 
                                                        |
| 37 | 37 |              if (strpos($key, 'SORT_FIELD_') === 0 && $val == $value) { | 
                                                        
| 38 | 38 | return strtolower(substr($key, 11));  | 
                                                        
| 39 | 39 | }  | 
                                                        
@@ -234,11 +234,11 @@  | 
                                                    ||
| 234 | 234 |              if ($mode != 'delete') { | 
                                                        
| 235 | 235 | $names = array();  | 
                                                        
| 236 | 236 | $descriptions = array();  | 
                                                        
| 237 | -                foreach($objectStateGroup->languageCodes as $languageCode) { | 
                                                        |
| 238 | - $names[$languageCode] = $objectStateGroup->getName($languageCode);  | 
                                                        |
| 237 | +                foreach ($objectStateGroup->languageCodes as $languageCode) { | 
                                                        |
| 238 | + $names[$languageCode] = $objectStateGroup->getName($languageCode);  | 
                                                        |
| 239 | 239 | }  | 
                                                        
| 240 | -                foreach($objectStateGroup->languageCodes as $languageCode) { | 
                                                        |
| 241 | - $descriptions[$languageCode] = $objectStateGroup->getDescription($languageCode);  | 
                                                        |
| 240 | +                foreach ($objectStateGroup->languageCodes as $languageCode) { | 
                                                        |
| 241 | + $descriptions[$languageCode] = $objectStateGroup->getDescription($languageCode);  | 
                                                        |
| 242 | 242 | }  | 
                                                        
| 243 | 243 | $groupData = array_merge(  | 
                                                        
| 244 | 244 | $groupData,  | 
                                                        
@@ -248,11 +248,11 @@  | 
                                                    ||
| 248 | 248 |              if ($mode != 'delete') { | 
                                                        
| 249 | 249 | $names = array();  | 
                                                        
| 250 | 250 | $descriptions = array();  | 
                                                        
| 251 | -                foreach($objectState->languageCodes as $languageCode) { | 
                                                        |
| 252 | - $names[$languageCode] = $objectState->getName($languageCode);  | 
                                                        |
| 251 | +                foreach ($objectState->languageCodes as $languageCode) { | 
                                                        |
| 252 | + $names[$languageCode] = $objectState->getName($languageCode);  | 
                                                        |
| 253 | 253 | }  | 
                                                        
| 254 | -                foreach($objectState->languageCodes as $languageCode) { | 
                                                        |
| 255 | - $descriptions[$languageCode] = $objectState->getDescription($languageCode);  | 
                                                        |
| 254 | +                foreach ($objectState->languageCodes as $languageCode) { | 
                                                        |
| 255 | + $descriptions[$languageCode] = $objectState->getDescription($languageCode);  | 
                                                        |
| 256 | 256 | }  | 
                                                        
| 257 | 257 | $groupData = array_merge(  | 
                                                        
| 258 | 258 | $groupData,  | 
                                                        
@@ -114,7 +114,7 @@  | 
                                                    ||
| 114 | 114 |      { | 
                                                        
| 115 | 115 | $migrationService = $this->migrationService;  | 
                                                        
| 116 | 116 | $executors = $migrationService->listExecutors();  | 
                                                        
| 117 | -        foreach($executors as $key => $name) { | 
                                                        |
| 117 | +        foreach ($executors as $key => $name) { | 
                                                        |
| 118 | 118 | $executor = $migrationService->getExecutor($name);  | 
                                                        
| 119 | 119 |              if (!$executor instanceof MigrationGeneratorInterface) { | 
                                                        
| 120 | 120 | unset($executors[$key]);  | 
                                                        
@@ -112,7 +112,7 @@  | 
                                                    ||
| 112 | 112 | |
| 113 | 113 | /**  | 
                                                        
| 114 | 114 | * @todo cache this for faster access  | 
                                                        
| 115 | - * @return array  | 
                                                        |
| 115 | + * @return integer[]  | 
                                                        |
| 116 | 116 | */  | 
                                                        
| 117 | 117 | protected function getGeneratingExecutors()  | 
                                                        
| 118 | 118 |      { | 
                                                        
@@ -104,7 +104,7 @@ discard block  | 
                                                    ||
| 104 | 104 | |
| 105 | 105 |          foreach ($contentIds as $contentId) { | 
                                                        
| 106 | 106 | $content = $this->repository->getContentService()->loadContent($contentId);  | 
                                                        
| 107 | -            foreach($this->repository->getLocationService()->loadLocations($content->contentInfo) as $location) { | 
                                                        |
| 107 | +            foreach ($this->repository->getLocationService()->loadLocations($content->contentInfo) as $location) { | 
                                                        |
| 108 | 108 | $locations[$location->id] = $location;  | 
                                                        
| 109 | 109 | }  | 
                                                        
| 110 | 110 | }  | 
                                                        
@@ -124,7 +124,7 @@ discard block  | 
                                                    ||
| 124 | 124 | |
| 125 | 125 |          foreach ($remoteContentIds as $remoteContentId) { | 
                                                        
| 126 | 126 | $content = $this->repository->getContentService()->loadContentByRemoteId($remoteContentId);  | 
                                                        
| 127 | -            foreach($this->repository->getLocationService()->loadLocations($content->contentInfo) as $location) { | 
                                                        |
| 127 | +            foreach ($this->repository->getLocationService()->loadLocations($content->contentInfo) as $location) { | 
                                                        |
| 128 | 128 | $locations[$location->id] = $location;  | 
                                                        
| 129 | 129 | }  | 
                                                        
| 130 | 130 | }  | 
                                                        
@@ -50,7 +50,9 @@ discard block  | 
                                                    ||
| 50 | 50 | |
| 51 | 51 | $query = new LocationQuery();  | 
                                                        
| 52 | 52 | $query->limit = self::INT_MAX_16BIT;  | 
                                                        
| 53 | - if (isset($query->performCount)) $query->performCount = false;  | 
                                                        |
| 53 | +            if (isset($query->performCount)) { | 
                                                        |
| 54 | + $query->performCount = false;  | 
                                                        |
| 55 | + }  | 
                                                        |
| 54 | 56 | $query->filter = $this->getQueryCriterion($key, $values);  | 
                                                        
| 55 | 57 | $results = $this->repository->getSearchService()->findLocations($query);  | 
                                                        
| 56 | 58 | |
@@ -196,7 +198,9 @@ discard block  | 
                                                    ||
| 196 | 198 |      { | 
                                                        
| 197 | 199 | $query = new LocationQuery();  | 
                                                        
| 198 | 200 | $query->limit = self::INT_MAX_16BIT;  | 
                                                        
| 199 | - if (isset($query->performCount)) $query->performCount = false;  | 
                                                        |
| 201 | +        if (isset($query->performCount)) { | 
                                                        |
| 202 | + $query->performCount = false;  | 
                                                        |
| 203 | + }  | 
                                                        |
| 200 | 204 | $query->filter = new Query\Criterion\ParentLocationId($parentLocationIds);  | 
                                                        
| 201 | 205 | |
| 202 | 206 | $results = $this->repository->getSearchService()->findLocations($query);  | 
                                                        
@@ -50,7 +50,7 @@ discard block  | 
                                                    ||
| 50 | 50 | /**  | 
                                                        
| 51 | 51 | * @param array $dsl  | 
                                                        
| 52 | 52 | * @param array $context  | 
                                                        
| 53 | - * @return true  | 
                                                        |
| 53 | + * @return boolean  | 
                                                        |
| 54 | 54 | * @throws \Exception  | 
                                                        
| 55 | 55 | */  | 
                                                        
| 56 | 56 | protected function cancel($dsl, $context)  | 
                                                        
@@ -70,7 +70,7 @@ discard block  | 
                                                    ||
| 70 | 70 | /**  | 
                                                        
| 71 | 71 | * @param array $dsl  | 
                                                        
| 72 | 72 | * @param array $context  | 
                                                        
| 73 | - * @return true  | 
                                                        |
| 73 | + * @return boolean  | 
                                                        |
| 74 | 74 | * @throws \Exception  | 
                                                        
| 75 | 75 | */  | 
                                                        
| 76 | 76 | protected function suspend($dsl, $context)  | 
                                                        
@@ -105,13 +105,13 @@ discard block  | 
                                                    ||
| 105 | 105 | $dsl['mode'] = 'load';  | 
                                                        
| 106 | 106 | // be kind to users and allow them not to specify this explicitly  | 
                                                        
| 107 | 107 |          if (isset($dsl['references'])) { | 
                                                        
| 108 | -            foreach($dsl['references'] as &$refDef) { | 
                                                        |
| 108 | +            foreach ($dsl['references'] as &$refDef) { | 
                                                        |
| 109 | 109 | $refDef['overwrite'] = true;  | 
                                                        
| 110 | 110 | }  | 
                                                        
| 111 | 111 | }  | 
                                                        
| 112 | 112 | $step = new MigrationStep($dsl['type'], $dsl, $context);  | 
                                                        
| 113 | 113 | |
| 114 | -        switch($dsl['type']) { | 
                                                        |
| 114 | +        switch ($dsl['type']) { | 
                                                        |
| 115 | 115 | case 'content':  | 
                                                        
| 116 | 116 | return $this->contentManager->execute($step);  | 
                                                        
| 117 | 117 | case 'location':  | 
                                                        
@@ -139,7 +139,7 @@ discard block  | 
                                                    ||
| 139 | 139 | return $this->matchConditions($values);  | 
                                                        
| 140 | 140 | |
| 141 | 141 | default:  | 
                                                        
| 142 | -                    throw new \Exception("Unknown until condition: '$key' when suspending a migration ".var_export($conditions, true)); | 
                                                        |
| 142 | +                    throw new \Exception("Unknown until condition: '$key' when suspending a migration " . var_export($conditions, true)); | 
                                                        |
| 143 | 143 | }  | 
                                                        
| 144 | 144 | }  | 
                                                        
| 145 | 145 | }  |