Completed
Push — master ( 2a6740...c8e4a8 )
by Gaetano
11:00
created
Core/ReferenceResolver/LocationResolver.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
     public function getReferenceValue($stringIdentifier)
35 35
     {
36 36
         $ref = $this->getReferenceIdentifierByPrefix($stringIdentifier);
37
-        switch($ref['prefix']) {
37
+        switch ($ref['prefix']) {
38 38
             case 'content_remote_id:':
39 39
                 return $this->repository->getContentService()->loadContentByRemoteId($ref['identifier'])->id;
40 40
             //case 'content_id::':
Please login to merge, or discard this patch.
Core/Executor/RoleManager.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
         if (array_key_exists('policies', $this->dsl)) {
44 44
             $ymlPolicies = $this->dsl['policies'];
45
-            foreach($ymlPolicies as $key => $ymlPolicy) {
45
+            foreach ($ymlPolicies as $key => $ymlPolicy) {
46 46
                 $this->addPolicy($role, $roleService, $ymlPolicy);
47 47
             }
48 48
         }
@@ -82,11 +82,11 @@  discard block
 block discarded – undo
82 82
                 // Removing all policies so we can add them back.
83 83
                 // TODO: Check and update policies instead of remove and add.
84 84
                 $policies = $role->getPolicies();
85
-                foreach($policies as $policy) {
85
+                foreach ($policies as $policy) {
86 86
                     $roleService->deletePolicy($policy);
87 87
                 }
88 88
 
89
-                foreach($ymlPolicies as $key => $ymlPolicy) {
89
+                foreach ($ymlPolicies as $key => $ymlPolicy) {
90 90
                     $this->addPolicy($role, $roleService, $ymlPolicy);
91 91
                 }
92 92
             }
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 
176 176
         $limitationValue = is_array($limitation['values']) ? $limitation['values'] : array($limitation['values']);
177 177
 
178
-        foreach($limitationValue as $id => $value) {
178
+        foreach ($limitationValue as $id => $value) {
179 179
             if ($this->referenceResolver->isReference($value)) {
180 180
                 $value = $this->referenceResolver->getReferenceValue($value);
181 181
                 $limitationValue[$id] = $value;
Please login to merge, or discard this patch.
Command/GenerateCommand.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
         }
81 81
 
82 82
         $activeBundles = array();
83
-        foreach($this->getApplication()->getKernel()->getBundles() as $bundle)
83
+        foreach ($this->getApplication()->getKernel()->getBundles() as $bundle)
84 84
         {
85 85
             $activeBundles[] = $bundle->getName();
86 86
         }
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
                     $className = 'Migration';
156 156
                 }
157 157
                 // Make sure that php class names are unique, not only migration definition file names
158
-                $existingMigrations = count(glob($migrationDirectory.'/*_' . $className .'*.php'));
158
+                $existingMigrations = count(glob($migrationDirectory . '/*_' . $className . '*.php'));
159 159
                 if ($existingMigrations) {
160 160
                     $className = $className . sprintf('%03d', $existingMigrations + 1);
161 161
                 }
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
         if ($migrationType == 'role') {
202 202
             $code = $this->generateRoleTemplate($parameters['role']);
203 203
         } else {
204
-            $code = $this->getContainer()->get('twig')->render($this->thisBundle . ':MigrationTemplate:'.$template, $parameters);
204
+            $code = $this->getContainer()->get('twig')->render($this->thisBundle . ':MigrationTemplate:' . $template, $parameters);
205 205
         }
206 206
 
207 207
         file_put_contents($path, $code);
Please login to merge, or discard this patch.
Core/Executor/ContentManager.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
             }
178 178
 
179 179
             $draft = $contentService->createContentDraft($contentInfo);
180
-            $contentService->updateContent($draft->versionInfo,$contentUpdateStruct);
180
+            $contentService->updateContent($draft->versionInfo, $contentUpdateStruct);
181 181
             $content = $contentService->publishVersion($draft->versionInfo);
182 182
 
183 183
             if (array_key_exists('new_remote_id', $this->dsl)) {
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
      * @param ContentCreateStruct $createStruct
222 222
      * @param array $fields
223 223
      */
224
-    protected function setFields(ContentCreateStruct &$createStruct, array $fields)
224
+    protected function setFields(ContentCreateStruct & $createStruct, array $fields)
225 225
     {
226 226
         foreach ($fields as $field) {
227 227
             // each $field is one key value pair
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
      * @param ContentUpdateStruct $updateStruct
249 249
      * @param array $fields
250 250
      */
251
-    protected function setFieldsToUpdate(ContentUpdateStruct &$updateStruct, array $fields, ContentType $contentType)
251
+    protected function setFieldsToUpdate(ContentUpdateStruct & $updateStruct, array $fields, ContentType $contentType)
252 252
     {
253 253
         foreach ($fields as $field) {
254 254
             // each $field is one key value pair
Please login to merge, or discard this patch.
Core/StorageHandler/Database.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@
 block discarded – undo
98 98
     /**
99 99
      * Creates and stores a new migration (leaving it in TODO status)
100 100
      * @param MigrationDefinition $migrationDefinition
101
-     * @return mixed
101
+     * @return Migration
102 102
      * @throws \Exception If the migration exists already (we rely on the PK for that)
103 103
      */
104 104
     public function addMigration(MigrationDefinition $migrationDefinition)
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
         );
117 117
         try {
118 118
             $conn->insert($this->migrationsTableName, $this->migrationToArray($migration));
119
-        } catch(UniqueConstraintViolationException $e) {
119
+        } catch (UniqueConstraintViolationException $e) {
120 120
             throw new \Exception("Migration '{$migrationDefinition->name}' already exists");
121 121
         }
122 122
 
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
         $t->addColumn('execution_error', 'string', array('length' => 4000, 'notnull' => false));
312 312
         $t->setPrimaryKey(array('migration'));
313 313
 
314
-        foreach($schema->toSql($dbPlatform) as $sql) {
314
+        foreach ($schema->toSql($dbPlatform) as $sql) {
315 315
             $this->dbHandler->exec($sql);
316 316
         }
317 317
     }
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
     {
327 327
         /** @var \Doctrine\DBAL\Schema\AbstractSchemaManager $sm */
328 328
         $sm = $this->dbHandler->getConnection()->getSchemaManager();
329
-        foreach($sm->listTables() as $table) {
329
+        foreach ($sm->listTables() as $table) {
330 330
             if ($table->getName() == $tableName) {
331 331
                 return true;
332 332
             }
Please login to merge, or discard this patch.
Command/MigrationCommand.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
      */
50 50
     protected function execute(InputInterface $input, OutputInterface $output)
51 51
     {
52
-        if (! $input->getOption('add') && ! $input->getOption('delete')) {
52
+        if (!$input->getOption('add') && !$input->getOption('delete')) {
53 53
             throw new \InvalidArgumentException('You must specify whether you want to --add or --delete the specified migration.');
54 54
         }
55 55
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
                 throw new \InvalidArgumentException(sprintf('The path "%s" does not correspond to any migration definition.', $migrationNameOrPath));
80 80
             }
81 81
 
82
-            foreach($migrationDefinitionCollection as $migrationDefinition) {
82
+            foreach ($migrationDefinitionCollection as $migrationDefinition) {
83 83
                 $migrationName = basename($migrationDefinition->path);
84 84
 
85 85
                 $migration = $migrationService->getMigration($migrationNameOrPath);
Please login to merge, or discard this patch.
Command/MigrateCommand.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 
68 68
         // filter away all migrations except 'to do' ones
69 69
         $toExecute = array();
70
-        foreach($migrationDefinitions as $name => $migrationDefinition) {
70
+        foreach ($migrationDefinitions as $name => $migrationDefinition) {
71 71
             if (!isset($migrations[$name]) || (($migration = $migrations[$name]) && $migration->status == Migration::STATUS_TODO)) {
72 72
                 $toExecute[$name] = $migrationsService->parseMigrationDefinition($migrationDefinition);
73 73
             }
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 
101 101
         $data = array();
102 102
         $i = 1;
103
-        foreach($toExecute as $name => $migrationDefinition) {
103
+        foreach ($toExecute as $name => $migrationDefinition) {
104 104
             $notes = '';
105 105
             if ($migrationDefinition->status != MigrationDefinition::STATUS_PARSED) {
106 106
                 $notes = '<error>' . $migrationDefinition->parsingError . '</error>';
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
             $output->writeln("=============================================\n");
136 136
         }
137 137
 
138
-        foreach($toExecute as $name => $migrationDefinition) {
138
+        foreach ($toExecute as $name => $migrationDefinition) {
139 139
 
140 140
             // let's skip migrations that we know are invalid - user was warned and he decided to proceed anyway
141 141
             if ($migrationDefinition->status == MigrationDefinition::STATUS_INVALID) {
@@ -147,12 +147,12 @@  discard block
 block discarded – undo
147 147
 
148 148
             try {
149 149
                 $migrationsService->executeMigration($migrationDefinition);
150
-            } catch(\Exception $e) {
150
+            } catch (\Exception $e) {
151 151
                 if ($input->getOption('ignore-failures')) {
152
-                    $output->writeln("\n<error>Migration failed! Reason: ".$this->getFullExceptionMessage($e)."</error>\n");
152
+                    $output->writeln("\n<error>Migration failed! Reason: " . $this->getFullExceptionMessage($e) . "</error>\n");
153 153
                     continue;
154 154
                 }
155
-                $output->writeln("\n<error>Migration aborted! Reason: ".$this->getFullExceptionMessage($e)."</error>");
155
+                $output->writeln("\n<error>Migration aborted! Reason: " . $this->getFullExceptionMessage($e) . "</error>");
156 156
                 return 1;
157 157
             }
158 158
 
Please login to merge, or discard this patch.
Tests/bootstrap.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 // try to load autoloade both when extension is top-level project and when it is installed as part of a working eZPUblish
4
-if (!file_exists($file = __DIR__.'/../vendor/autoload.php') && !file_exists($file = __DIR__.'/../../../../vendor/autoload.php')) {
4
+if (!file_exists($file = __DIR__ . '/../vendor/autoload.php') && !file_exists($file = __DIR__ . '/../../../../vendor/autoload.php')) {
5 5
     throw new \RuntimeException('Install the dependencies to run the test suite.');
6 6
 }
7 7
 
Please login to merge, or discard this patch.
Tests/phpunit/1_GenerateTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-include_once(__DIR__.'/CommandTest.php');
3
+include_once(__DIR__ . '/CommandTest.php');
4 4
 
5 5
 use Symfony\Component\Console\Input\ArrayInput;
6 6
 
@@ -64,6 +64,6 @@  discard block
 block discarded – undo
64 64
         $exitCode = $this->app->run($input, $this->output);
65 65
         $output = $this->output->fetch();
66 66
         $this->assertSame(0, $exitCode);
67
-        $this->assertRegExp('?\| ' . basename($filePath) . ' +\| not executed \|?', $output );
67
+        $this->assertRegExp('?\| ' . basename($filePath) . ' +\| not executed \|?', $output);
68 68
     }
69 69
 }
Please login to merge, or discard this patch.