@@ -90,6 +90,9 @@ |
||
| 90 | 90 | ); |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | + /** |
|
| 94 | + * @param string $fileName |
|
| 95 | + */ |
|
| 93 | 96 | protected function getClassNameFromFile($fileName) |
| 94 | 97 | { |
| 95 | 98 | $parts = explode('_', pathinfo($fileName, PATHINFO_FILENAME), 2); |
@@ -179,7 +179,7 @@ |
||
| 179 | 179 | * @throws \InvalidArgumentException When trying to set |
| 180 | 180 | * |
| 181 | 181 | * @param \eZ\Publish\API\Repository\Values\ContentType\ContentType $contentType |
| 182 | - * @return boolean |
|
| 182 | + * @return false|null |
|
| 183 | 183 | */ |
| 184 | 184 | protected function setReferences($contentType) |
| 185 | 185 | { |
@@ -393,8 +393,7 @@ |
||
| 393 | 393 | $ret[$key] = $this->referenceResolver->getReferenceValue($val); |
| 394 | 394 | } |
| 395 | 395 | } |
| 396 | - } |
|
| 397 | - else { |
|
| 396 | + } else { |
|
| 398 | 397 | $ret = $value; |
| 399 | 398 | |
| 400 | 399 | if ($this->referenceResolver->isReference($value)) { |
@@ -287,7 +287,7 @@ |
||
| 287 | 287 | * |
| 288 | 288 | * @param \eZ\Publish\API\Repository\Values\User\Role $role |
| 289 | 289 | * @param \eZ\Publish\API\Repository\RoleService $roleService |
| 290 | - * @param array $policies |
|
| 290 | + * @param array $policy |
|
| 291 | 291 | */ |
| 292 | 292 | private function addPolicy(Role $role, RoleService $roleService, array $policy) |
| 293 | 293 | { |
@@ -79,11 +79,11 @@ discard block |
||
| 79 | 79 | // Removing all policies so we can add them back. |
| 80 | 80 | // TODO: Check and update policies instead of remove and add. |
| 81 | 81 | $policies = $role->getPolicies(); |
| 82 | - foreach($policies as $policy) { |
|
| 82 | + foreach ($policies as $policy) { |
|
| 83 | 83 | $roleService->deletePolicy($policy); |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - foreach($ymlPolicies as $key => $ymlPolicy) { |
|
| 86 | + foreach ($ymlPolicies as $key => $ymlPolicy) { |
|
| 87 | 87 | $this->addPolicy($role, $roleService, $ymlPolicy); |
| 88 | 88 | } |
| 89 | 89 | } |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | |
| 173 | 173 | $limitationValue = is_array($limitation['values']) ? $limitation['values'] : array($limitation['values']); |
| 174 | 174 | |
| 175 | - foreach($limitationValue as $id => $value) { |
|
| 175 | + foreach ($limitationValue as $id => $value) { |
|
| 176 | 176 | if ($this->referenceResolver->isReference($value)) { |
| 177 | 177 | $value = $this->geferenceResolver->getReferenceValue($value); |
| 178 | 178 | $limitationValue[$id] = $value; |
@@ -66,7 +66,7 @@ |
||
| 66 | 66 | |
| 67 | 67 | /** |
| 68 | 68 | * @param $object |
| 69 | - * @return mixed |
|
| 69 | + * @return false|null |
|
| 70 | 70 | */ |
| 71 | 71 | protected function setReferences($object) |
| 72 | 72 | { |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | |
| 13 | 13 | protected $tagService; |
| 14 | 14 | |
| 15 | - public function __construct(TagsService $tagService=null) |
|
| 15 | + public function __construct(TagsService $tagService = null) |
|
| 16 | 16 | { |
| 17 | 17 | $this->tagService = $tagService; |
| 18 | 18 | } |
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | 25 | * @param string $stringIdentifier |
| 26 | - * @return mixed |
|
| 26 | + * @return integer |
|
| 27 | 27 | */ |
| 28 | 28 | public function isReference($stringIdentifier) |
| 29 | 29 | { |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | public function __construct() |
| 16 | 16 | { |
| 17 | 17 | $quotedPrefixes = []; |
| 18 | - foreach($this->referencePrefixes as $prefix) { |
|
| 18 | + foreach ($this->referencePrefixes as $prefix) { |
|
| 19 | 19 | $quotedPrefixes[] = preg_quote($prefix, '/'); |
| 20 | 20 | } |
| 21 | 21 | $this->prefixMatchRegexp = '/^(' . implode('|', $quotedPrefixes) . ')/'; |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | */ |
| 56 | 56 | protected function getReferenceIdentifierByPrefix($stringIdentifier) |
| 57 | 57 | { |
| 58 | - foreach($this->referencePrefixes as $prefix) { |
|
| 58 | + foreach ($this->referencePrefixes as $prefix) { |
|
| 59 | 59 | $regexp = '/^' . preg_quote($prefix, '/') . '/'; |
| 60 | 60 | if (preg_match($regexp, $stringIdentifier)) { |
| 61 | 61 | return array('prefix' => $prefix, 'identifier' => preg_replace($regexp, '', $stringIdentifier)); |
@@ -1,7 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | use Kaliop\eZMigrationBundle\API\MigrationInterface; |
| 4 | - |
|
| 5 | 4 | use Symfony\Component\DependencyInjection\ContainerInterface; |
| 6 | 5 | use Kaliop\eZMigrationBundle\API\Value\Migration; |
| 7 | 6 | use Kaliop\eZMigrationBundle\API\Value\MigrationDefinition; |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | $this->dbHandler = $this->container->get('ezpublish.connection'); |
| 37 | 37 | |
| 38 | 38 | $this->activeBundles = array(); |
| 39 | - foreach($this->container->get('kernel')->getBundles() as $bundle) |
|
| 39 | + foreach ($this->container->get('kernel')->getBundles() as $bundle) |
|
| 40 | 40 | { |
| 41 | 41 | $this->activeBundles[$bundle->getName()] = $bundle->getPath(); |
| 42 | 42 | } |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | // we need to decide of a random time to stamp existing migrations. We use 'now - 1 minute'... |
| 59 | 59 | $executionDate = time() - 60; |
| 60 | - foreach($toMigrate as $legacyMigration) { |
|
| 60 | + foreach ($toMigrate as $legacyMigration) { |
|
| 61 | 61 | $name = $legacyMigration['version']; |
| 62 | 62 | |
| 63 | 63 | $path = $this->getLegacyMigrationDefinition($legacyMigration['version'], $legacyMigration['bundle']); |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | { |
| 105 | 105 | /** @var \Doctrine\DBAL\Schema\AbstractSchemaManager $sm */ |
| 106 | 106 | $sm = $this->dbHandler->getConnection()->getSchemaManager(); |
| 107 | - foreach($sm->listTables() as $table) { |
|
| 107 | + foreach ($sm->listTables() as $table) { |
|
| 108 | 108 | if ($table->getName() == $tableName) { |
| 109 | 109 | return true; |
| 110 | 110 | } |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | return false; |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - foreach($versionDefinitions as $key => $versionDefinition) { |
|
| 154 | + foreach ($versionDefinitions as $key => $versionDefinition) { |
|
| 155 | 155 | if (!in_array(pathinfo($versionDefinition, PATHINFO_EXTENSION), array('php', 'yml', 'sql'))) { |
| 156 | 156 | unset($versionDefinitions[$key]); |
| 157 | 157 | } |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | * @param MigrationStep[] $steps |
| 34 | 34 | * @param string $parsingError |
| 35 | 35 | */ |
| 36 | - function __construct($name, $path, $rawDefinition, $status = 0, array $steps=array(), $parsingError = null) |
|
| 36 | + function __construct($name, $path, $rawDefinition, $status = 0, array $steps = array(), $parsingError = null) |
|
| 37 | 37 | { |
| 38 | 38 | $this->name = $name; |
| 39 | 39 | $this->path = $path; |
@@ -15,9 +15,9 @@ discard block |
||
| 15 | 15 | * @param int $flags |
| 16 | 16 | * @param string $iterator_class |
| 17 | 17 | */ |
| 18 | - public function __construct ($input = array(), $flags = 0, $iterator_class = "ArrayIterator") |
|
| 18 | + public function __construct($input = array(), $flags = 0, $iterator_class = "ArrayIterator") |
|
| 19 | 19 | { |
| 20 | - foreach($input as $value) { |
|
| 20 | + foreach ($input as $value) { |
|
| 21 | 21 | if (!is_a($value, $this->allowedClass)) { |
| 22 | 22 | $this->throwInvalid($value); |
| 23 | 23 | } |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | /** |
| 28 | 28 | * @param mixed $value |
| 29 | 29 | */ |
| 30 | - public function append ($value) |
|
| 30 | + public function append($value) |
|
| 31 | 31 | { |
| 32 | 32 | if (!is_a($value, $this->allowedClass)) { |
| 33 | 33 | $this->throwInvalid($value); |
@@ -37,9 +37,9 @@ discard block |
||
| 37 | 37 | /** |
| 38 | 38 | * @param mixed $input |
| 39 | 39 | */ |
| 40 | - public function exchangeArray ($input) |
|
| 40 | + public function exchangeArray($input) |
|
| 41 | 41 | { |
| 42 | - foreach($input as $value) { |
|
| 42 | + foreach ($input as $value) { |
|
| 43 | 43 | if (!is_a($value, $this->allowedClass)) { |
| 44 | 44 | $this->throwInvalid($value); |
| 45 | 45 | } |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | * @param mixed $index |
| 51 | 51 | * @param mixed $newval |
| 52 | 52 | */ |
| 53 | - public function offsetSet ($index , $newval) |
|
| 53 | + public function offsetSet($index, $newval) |
|
| 54 | 54 | { |
| 55 | 55 | if (!is_a($newval, $this->allowedClass)) { |
| 56 | 56 | $this->throwInvalid($newval); |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | $configuration = new Configuration(); |
| 23 | 23 | $config = $this->processConfiguration($configuration, $configs); |
| 24 | 24 | |
| 25 | - $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
|
| 25 | + $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); |
|
| 26 | 26 | $loader->load('services.yml'); |
| 27 | 27 | } |
| 28 | 28 | } |