Passed
Push — develop ( 650334...a9374a )
by Andrew
06:34
created
src/services/OptimizedImages.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
                             $index->fileExists = 0;
112 112
                             $transforms->storeTransformIndexData($index);
113 113
                             $volume = $asset->getVolume();
114
-                            $transformPath = $asset->folderPath . $transforms->getTransformSubpath($asset, $index);
114
+                            $transformPath = $asset->folderPath.$transforms->getTransformSubpath($asset, $index);
115 115
                             try {
116 116
                                 $volume->deleteFile($transformPath);
117 117
                             } catch (\Throwable $exception) {
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
                             $msg = 'Failed to update transform: '.$e->getMessage();
121 121
                             Craft::error($msg, __METHOD__);
122 122
                             if (Craft::$app instanceof ConsoleApplication) {
123
-                                echo $msg . PHP_EOL;
123
+                                echo $msg.PHP_EOL;
124 124
                             }
125 125
                             // Add the error message to the stickyErrors for the model
126 126
                             $model->stickyErrors[] = $msg;
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
                         __METHOD__
145 145
                     );
146 146
                     if (Craft::$app instanceof ConsoleApplication) {
147
-                        echo $msg . PHP_EOL;
147
+                        echo $msg.PHP_EOL;
148 148
                     }
149 149
                     if ($canManipulate) {
150 150
                         // Add the error message to the stickyErrors for the model
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
                                 $folder = $asset->getFolder();
216 216
                                 while ($folder !== null && !$createVariants) {
217 217
                                     if ($folder->uid === $subfolder || $folder->name === $subfolder) {
218
-                                        Craft::info('Matched subfolder uid: ' . print_r($subfolder, true), __METHOD__);
218
+                                        Craft::info('Matched subfolder uid: '.print_r($subfolder, true), __METHOD__);
219 219
                                         $createVariants = true;
220 220
                                     } else {
221 221
                                         $folder = $folder->getParent();
@@ -502,20 +502,20 @@  discard block
 block discarded – undo
502 502
         }
503 503
         $useAspectRatio = $variant['useAspectRatio'] ?? false;
504 504
         if ($useAspectRatio) {
505
-            $aspectRatio = (float)$variant['aspectRatioX'] / (float)$variant['aspectRatioY'];
505
+            $aspectRatio = (float) $variant['aspectRatioX'] / (float) $variant['aspectRatioY'];
506 506
         } else {
507
-            $aspectRatio = (float)$asset->width / (float)$asset->height;
507
+            $aspectRatio = (float) $asset->width / (float) $asset->height;
508 508
         }
509
-        $width = (int)$variant['width'] * (int)$retinaSize;
509
+        $width = (int) $variant['width'] * (int) $retinaSize;
510 510
         $transform->width = $width;
511
-        $transform->height = (int)($width / $aspectRatio);
511
+        $transform->height = (int) ($width / $aspectRatio);
512 512
         // Image quality
513
-        $quality = (int)($variant['quality'] ?? null);
513
+        $quality = (int) ($variant['quality'] ?? null);
514 514
         if (empty($quality)) {
515 515
             $quality = null;
516 516
         }
517 517
         if ($quality !== null && $settings->lowerQualityRetinaImageVariants && $retinaSize != '1') {
518
-            $quality = (int)($quality * (1.5 / (int)$retinaSize));
518
+            $quality = (int) ($quality * (1.5 / (int) $retinaSize));
519 519
         }
520 520
         $transform->quality = $quality;
521 521
         // Interlaced (progressive JPEGs or interlaced PNGs)
Please login to merge, or discard this patch.
src/fields/OptimizedImages.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -326,14 +326,14 @@  discard block
 block discarded – undo
326 326
         $sizesWrapperId = Craft::$app->getView()->namespaceInputId('sizes-wrapper');
327 327
         $view = Craft::$app->getView();
328 328
         $view->registerJs(
329
-            "document.addEventListener('vite-script-loaded',function (e) {" .
330
-            "if (e.detail.path === 'src/js/OptimizedImagesField.js') {" .
331
-            'new Craft.OptimizedImagesInput(' .
332
-            '"' . $namespacedId . '", ' .
333
-            '"' . $namespacePrefix . '",' .
334
-            '"' . $sizesWrapperId . '"' .
335
-            ');' .
336
-            '}' .
329
+            "document.addEventListener('vite-script-loaded',function (e) {".
330
+            "if (e.detail.path === 'src/js/OptimizedImagesField.js') {".
331
+            'new Craft.OptimizedImagesInput('.
332
+            '"'.$namespacedId.'", '.
333
+            '"'.$namespacePrefix.'",'.
334
+            '"'.$sizesWrapperId.'"'.
335
+            ');'.
336
+            '}'.
337 337
             '});',
338 338
             $view::POS_HEAD
339 339
         );
@@ -497,12 +497,12 @@  discard block
 block discarded – undo
497 497
             $jsonVars = Json::encode($jsonVars);
498 498
             $view = Craft::$app->getView();
499 499
             $view->registerJs(
500
-                "document.addEventListener('vite-script-loaded',function (e) {" .
501
-                "if (e.detail.path === 'src/js/OptimizedImagesField.js') {" .
502
-                "$('#{$nameSpaceId}-field').ImageOptimizeOptimizedImages(" .
503
-                $jsonVars .
504
-                ");" .
505
-                '}' .
500
+                "document.addEventListener('vite-script-loaded',function (e) {".
501
+                "if (e.detail.path === 'src/js/OptimizedImagesField.js') {".
502
+                "$('#{$nameSpaceId}-field').ImageOptimizeOptimizedImages(".
503
+                $jsonVars.
504
+                ");".
505
+                '}'.
506 506
                 '});',
507 507
                 $view::POS_HEAD
508 508
             );
Please login to merge, or discard this patch.