Completed
Push — SWP-2230-php7-fix ( 3795ee )
by
unknown
30s
created
src/SWP/Bundle/CoreBundle/Command/FillArticleExtraTableCommand.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
             $options .= "- Truncate [1]\n";
70 70
             $options .= "- Overwrite [2]\n";
71 71
             $options .= "- Exit [3]\n";
72
-            $res = (int)readline($options);
72
+            $res = (int) readline($options);
73 73
             if ($res > 2) {
74 74
                 exit(1);
75 75
             }
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
         $totalArticlesProcessed = 0;
84 84
         $isProcessing = true;
85 85
 
86
-        echo "Info: " . $totalArticles . " articles will be processed\n" ;
86
+        echo "Info: ".$totalArticles." articles will be processed\n";
87 87
         sleep(1);
88 88
         $startTime = microtime(true);
89 89
         $iterations = $emptyExtra = $invalidExtra = 0;
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
         while ($isProcessing) {
92 92
             $iterations++;
93 93
             echo "\033[1A\033[K";
94
-            echo "==> Processed: " . $totalArticlesProcessed . "/" . $totalArticles . " articles in " .  (microtime(true) - $startTime) . "\n";
94
+            echo "==> Processed: ".$totalArticlesProcessed."/".$totalArticles." articles in ".(microtime(true) - $startTime)."\n";
95 95
             $sql = "SELECT id, extra FROM swp_article order by id ASC  OFFSET (($iterations -1) * $limit) LIMIT $limit";
96 96
             $query = $this->entityManager->getConnection()->prepare($sql);
97 97
             $query->execute();
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
                     if (is_array($extraItem)) {
142 142
                         $extra = ArticleExtraEmbedField::newFromValue($key, $extraItem);
143 143
                     } else {
144
-                        $extra = ArticleExtraTextField::newFromValue($key, (string)$extraItem);
144
+                        $extra = ArticleExtraTextField::newFromValue($key, (string) $extraItem);
145 145
                     }
146 146
                     $extra->setArticle($article);
147 147
                 }
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
         echo "\t- Empty extra: $emptyExtra\n";
190 190
         echo "\t- Invalid extra: $invalidExtra\n";
191 191
         echo "\t- Iterations: $iterations\n";
192
-        echo "\t- Duplicates count: " . count($duplicates) . "\n";
192
+        echo "\t- Duplicates count: ".count($duplicates)."\n";
193 193
         echo "=================------==================\n";
194 194
 
195 195
         $finalResult = [
@@ -200,9 +200,9 @@  discard block
 block discarded – undo
200 200
             'duplicates' => $duplicates
201 201
         ];
202 202
         $fileName = '/tmp/fill-article-extra.json';
203
-        file_put_contents($fileName, PHP_EOL . json_encode($finalResult), FILE_APPEND);
203
+        file_put_contents($fileName, PHP_EOL.json_encode($finalResult), FILE_APPEND);
204 204
 
205
-        echo ">> See more results in " . $fileName . " file";
205
+        echo ">> See more results in ".$fileName." file";
206 206
         exit(1);
207 207
     }
208 208
 
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
     protected function deletePreviousExtra(int $id)
220 220
     {
221 221
         $this->entityManager->flush();
222
-        $sql = "DELETE FROM swp_article_extra sae WHERE sae.article_id=" . $id;
222
+        $sql = "DELETE FROM swp_article_extra sae WHERE sae.article_id=".$id;
223 223
         $query = $this->entityManager->getConnection()->prepare($sql);
224 224
         $query->execute();
225 225
         $this->entityManager->flush();
Please login to merge, or discard this patch.