Passed
Push — develop ( a752da...61f94b )
by Andrew
06:59
created
src/fields/OptimizedImages.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -207,7 +207,7 @@
 block discarded – undo
207 207
             if (!$asset->propagating) {
208 208
                 // If the scenario is Asset::SCENARIO_FILEOPS treat it as a new asset
209 209
                 $scenario = $asset->getScenario();
210
-                if ($isNew || $scenario === Asset::SCENARIO_FILEOPS ) {
210
+                if ($isNew || $scenario === Asset::SCENARIO_FILEOPS) {
211 211
                     /**
212 212
                      * If this is a newly uploaded/created Asset, we can save the variants
213 213
                      * via a queue job to prevent it from blocking
Please login to merge, or discard this patch.
src/services/OptimizedImages.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
                             $index->fileExists = 0;
111 111
                             $transforms->storeTransformIndexData($index);
112 112
                             $volume = $asset->getVolume();
113
-                            $transformPath = $asset->folderPath . $transforms->getTransformSubpath($asset, $index);
113
+                            $transformPath = $asset->folderPath.$transforms->getTransformSubpath($asset, $index);
114 114
                             try {
115 115
                                 $volume->deleteFile($transformPath);
116 116
                             } catch (\Throwable $exception) {
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
                             $msg = 'Failed to update transform: '.$e->getMessage();
120 120
                             Craft::error($msg, __METHOD__);
121 121
                             if (Craft::$app instanceof ConsoleApplication) {
122
-                                echo $msg . PHP_EOL;
122
+                                echo $msg.PHP_EOL;
123 123
                             }
124 124
                         }
125 125
                     }
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
                         __METHOD__
141 141
                     );
142 142
                     if (Craft::$app instanceof ConsoleApplication) {
143
-                        echo $msg . PHP_EOL;
143
+                        echo $msg.PHP_EOL;
144 144
                     }
145 145
                 }
146 146
             }
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
                                 $folder = $asset->getFolder();
201 201
                                 while ($folder !== null && !$createVariants) {
202 202
                                     if ($folder->uid === $subfolder) {
203
-                                        Craft::info('Matched subfolder uid: ' . print_r($subfolder, true), __METHOD__);
203
+                                        Craft::info('Matched subfolder uid: '.print_r($subfolder, true), __METHOD__);
204 204
                                         $createVariants = true;
205 205
                                     } else {
206 206
                                         $folder = $folder->getParent();
@@ -478,20 +478,20 @@  discard block
 block discarded – undo
478 478
         }
479 479
         $useAspectRatio = $variant['useAspectRatio'] ?? false;
480 480
         if ($useAspectRatio) {
481
-            $aspectRatio = (int)$variant['aspectRatioX'] / (int)$variant['aspectRatioY'];
481
+            $aspectRatio = (int) $variant['aspectRatioX'] / (int) $variant['aspectRatioY'];
482 482
         } else {
483
-            $aspectRatio = (int)$asset->width / (int)$asset->height;
483
+            $aspectRatio = (int) $asset->width / (int) $asset->height;
484 484
         }
485
-        $width = (int)$variant['width'] * (int)$retinaSize;
485
+        $width = (int) $variant['width'] * (int) $retinaSize;
486 486
         $transform->width = $width;
487
-        $transform->height = (int)($width / $aspectRatio);
487
+        $transform->height = (int) ($width / $aspectRatio);
488 488
         // Image quality
489
-        $quality = (int)($variant['quality'] ?? null);
489
+        $quality = (int) ($variant['quality'] ?? null);
490 490
         if (empty($quality)) {
491 491
             $quality = null;
492 492
         }
493 493
         if ($quality !== null && $settings->lowerQualityRetinaImageVariants && $retinaSize != '1') {
494
-            $quality = (int)($quality * (1.5 / (int)$retinaSize));
494
+            $quality = (int) ($quality * (1.5 / (int) $retinaSize));
495 495
         }
496 496
         $transform->quality = $quality;
497 497
         // Interlaced (progressive JPEGs or interlaced PNGs)
Please login to merge, or discard this patch.
src/services/Placeholder.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
         );
89 89
         $result = '';
90 90
         $width = self::PLACEHOLDER_WIDTH;
91
-        $height = (int)($width / $aspectRatio);
91
+        $height = (int) ($width / $aspectRatio);
92 92
         $placeholderPath = $this->createImageFromPath($tempPath, $width, $height, self::PLACEHOLDER_QUALITY, $position);
93 93
         if (!empty($placeholderPath)) {
94 94
             $result = base64_encode(file_get_contents($placeholderPath));
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
     {
111 111
         Craft::beginProfile('generateColorPalette', __METHOD__);
112 112
         Craft::info(
113
-            'Generating color palette for: ' . $tempPath,
113
+            'Generating color palette for: '.$tempPath,
114 114
             __METHOD__
115 115
         );
116 116
         $colorPalette = [];
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
             $lightness /= $colorCount;
157 157
         }
158 158
 
159
-        return $lightness === null ? $lightness : (int)$lightness;
159
+        return $lightness === null ? $lightness : (int) $lightness;
160 160
     }
161 161
     /**
162 162
      * Generate an SVG image via Potrace
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
             __METHOD__
220 220
         );
221 221
         $width = self::TEMP_PLACEHOLDER_WIDTH;
222
-        $height = (int)($width / $aspectRatio);
222
+        $height = (int) ($width / $aspectRatio);
223 223
         $tempPath = $this->createImageFromAsset($asset, $width, $height, self::TEMP_PLACEHOLDER_QUALITY, $position);
224 224
         Craft::endProfile('createTempPlaceholderImage', __METHOD__);
225 225
 
Please login to merge, or discard this patch.
src/jobs/ResaveOptimizedImages.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -91,8 +91,8 @@  discard block
 block discarded – undo
91 91
         while ($currentElement < $totalElements) {
92 92
             $elements = $paginator->getPageResults();
93 93
             if (Craft::$app instanceof ConsoleApplication) {
94
-                echo 'Query ' . $paginator->getCurrentPage() . '/' . $paginator->getTotalPages()
95
-                    . ' - assets: ' . $paginator->getTotalResults()
94
+                echo 'Query '.$paginator->getCurrentPage().'/'.$paginator->getTotalPages()
95
+                    . ' - assets: '.$paginator->getTotalResults()
96 96
                     . PHP_EOL;
97 97
             }
98 98
             /** @var ElementInterface $element */
@@ -107,9 +107,9 @@  discard block
 block discarded – undo
107 107
                         if ($field instanceof OptimizedImagesField && $element instanceof Asset) {
108 108
                             if ($this->fieldId === null || $field->id == $this->fieldId) {
109 109
                                 if (Craft::$app instanceof ConsoleApplication) {
110
-                                    echo $currentElement . '/' . $totalElements
111
-                                        . ' - processing asset: ' . $element->title
112
-                                        . ' from field: ' . $field->name . PHP_EOL;
110
+                                    echo $currentElement.'/'.$totalElements
111
+                                        . ' - processing asset: '.$element->title
112
+                                        . ' from field: '.$field->name.PHP_EOL;
113 113
                                 }
114 114
                                 try {
115 115
                                     ImageOptimize::$plugin->optimizedImages->updateOptimizedImageFieldData($field, $element, $this->force);
@@ -119,9 +119,9 @@  discard block
 block discarded – undo
119 119
                                         echo '[error]: '
120 120
                                             . $e->getMessage()
121 121
                                             . ' while processing '
122
-                                            . $currentElement . '/' . $totalElements
123
-                                            . ' - processing asset: ' . $element->title
124
-                                            . ' from field: ' . $field->name . PHP_EOL;
122
+                                            . $currentElement.'/'.$totalElements
123
+                                            . ' - processing asset: '.$element->title
124
+                                            . ' from field: '.$field->name.PHP_EOL;
125 125
                                     }
126 126
                                 }
127 127
                             }
Please login to merge, or discard this patch.