@@ -24,13 +24,13 @@ |
||
| 24 | 24 | $locations = array(); |
| 25 | 25 | switch ($key) { |
| 26 | 26 | case self::MATCH_LOCATION_ID: |
| 27 | - foreach($match as $locationId) { |
|
| 27 | + foreach ($match as $locationId) { |
|
| 28 | 28 | $location = $this->repository->getLocationService()->loadLocation($locationId); |
| 29 | 29 | $locations[$location->id] = $location; |
| 30 | 30 | } |
| 31 | 31 | break; |
| 32 | 32 | case self::MATCH_LOCATION_REMOTE_ID: |
| 33 | - foreach($match as $locationRemoteId) { |
|
| 33 | + foreach ($match as $locationRemoteId) { |
|
| 34 | 34 | $location = $this->repository->getLocationService()->loadLocationByRemoteId($locationRemoteId); |
| 35 | 35 | $locations[$location->id] = $location; |
| 36 | 36 | } |
@@ -15,7 +15,6 @@ |
||
| 15 | 15 | * @param array $sort |
| 16 | 16 | * @param int $offset |
| 17 | 17 | * @param int $limit |
| 18 | - |
|
| 19 | 18 | * @return LocationCollection |
| 20 | 19 | */ |
| 21 | 20 | public function matchLocation(array $conditions, array $sort = array(), $offset = 0, $limit = 0) |
@@ -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), |
@@ -60,8 +60,7 @@ |
||
| 60 | 60 | } |
| 61 | 61 | } |
| 62 | 62 | } |
| 63 | - } |
|
| 64 | - else { |
|
| 63 | + } else { |
|
| 65 | 64 | throw new \Exception("Path '$path' is neither a file nor directory"); |
| 66 | 65 | } |
| 67 | 66 | } |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | $currentProcesses = array_splice($processesQueue, 0, $maxParallel); |
| 29 | 29 | // start the initial stack of processes |
| 30 | 30 | foreach ($currentProcesses as $process) { |
| 31 | - $process->start(function ($type, $buffer) use ($callback, $process) { |
|
| 31 | + $process->start(function($type, $buffer) use ($callback, $process) { |
|
| 32 | 32 | if ($callback) { |
| 33 | 33 | $callback($type, $buffer, $process); |
| 34 | 34 | } |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | // directly add and start new process after the previous finished |
| 45 | 45 | if (count($processesQueue) > 0) { |
| 46 | 46 | $nextProcess = array_shift($processesQueue); |
| 47 | - $nextProcess->start(function ($type, $buffer) use ($callback, $nextProcess) { |
|
| 47 | + $nextProcess->start(function($type, $buffer) use ($callback, $nextProcess) { |
|
| 48 | 48 | if ($callback) { |
| 49 | 49 | $callback($type, $buffer, $nextProcess); |
| 50 | 50 | } |
@@ -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 |
@@ -74,7 +74,7 @@ |
||
| 74 | 74 | } else { |
| 75 | 75 | $args = array(); |
| 76 | 76 | } |
| 77 | - foreach($args as &$val) { |
|
| 77 | + foreach ($args as &$val) { |
|
| 78 | 78 | $val = $this->resolveReferencesRecursively($val); |
| 79 | 79 | } |
| 80 | 80 | |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | public function hasEmbeddedReferences($string) |
| 19 | 19 | { |
| 20 | 20 | $regexp = $this->getEmbeddedRegexp(); |
| 21 | - return (bool) preg_match_all($regexp, $string, $matches); |
|
| 21 | + return (bool)preg_match_all($regexp, $string, $matches); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | /** |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | { |
| 53 | 53 | // we need to alter the regexp we usr for std ref resolving, as it will be used to match parts of text, not the whole string |
| 54 | 54 | $regexp = substr($this->getRegexp(), 1, -1); |
| 55 | - return '/' . preg_quote($this->beginToken). preg_replace(array('/^\^/'), array(''), $regexp) . '[^' . $this->endToken . ']+' . preg_quote($this->endToken) . '/'; |
|
| 55 | + return '/' . preg_quote($this->beginToken) . preg_replace(array('/^\^/'), array(''), $regexp) . '[^' . $this->endToken . ']+' . preg_quote($this->endToken) . '/'; |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | /** |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | { |
| 12 | 12 | public function setReferenceResolver(ReferenceResolverInterface $referenceResolver) |
| 13 | 13 | { |
| 14 | - if (! $referenceResolver instanceof EmbeddedReferenceResolverInterface) { |
|
| 14 | + if (!$referenceResolver instanceof EmbeddedReferenceResolverInterface) { |
|
| 15 | 15 | throw new \Exception("Reference resolver injected into EzRichText field handler should implement EmbeddedReferenceResolverInterface"); |
| 16 | 16 | } |
| 17 | 17 | parent::setReferenceResolver($referenceResolver); |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | { |
| 12 | 12 | public function setReferenceResolver(ReferenceResolverInterface $referenceResolver) |
| 13 | 13 | { |
| 14 | - if (! $referenceResolver instanceof EmbeddedReferenceResolverInterface) { |
|
| 14 | + if (!$referenceResolver instanceof EmbeddedReferenceResolverInterface) { |
|
| 15 | 15 | throw new \Exception("Reference resolver injected into EzXmlText field handler should implement EmbeddedReferenceResolverInterface"); |
| 16 | 16 | } |
| 17 | 17 | parent::setReferenceResolver($referenceResolver); |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | } |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | - foreach($referencesDefs as $reference) { |
|
| 228 | + foreach ($referencesDefs as $reference) { |
|
| 229 | 229 | $overwrite = false; |
| 230 | 230 | if (isset($reference['overwrite'])) { |
| 231 | 231 | $overwrite = $reference['overwrite']; |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | { |
| 247 | 247 | // allow setting *some* refs even when we have 0 or N matches |
| 248 | 248 | foreach ($referencesDefinition as $key => $reference) { |
| 249 | - switch($reference['attribute']) { |
|
| 249 | + switch ($reference['attribute']) { |
|
| 250 | 250 | |
| 251 | 251 | case 'count': |
| 252 | 252 | $value = count($entity); |
@@ -329,8 +329,9 @@ |
||
| 329 | 329 | { |
| 330 | 330 | if (isset($step->dsl['references_type']) && $step->dsl['references_type'] == self::REFERENCE_TYPE_ARRAY && |
| 331 | 331 | isset($step->dsl['references_allow_empty']) && $step->dsl['references_allow_empty'] == true |
| 332 | - ) |
|
| 333 | - return true; |
|
| 332 | + ) { |
|
| 333 | + return true; |
|
| 334 | + } |
|
| 334 | 335 | return false; |
| 335 | 336 | } |
| 336 | 337 | |