Passed
Push — develop ( c41d42...9956ef )
by Andrew
06:57 queued 01:52
created
src/ImageOptimize.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
         Event::on(
288 288
             CraftVariable::class,
289 289
             CraftVariable::EVENT_INIT,
290
-            function (Event $event) {
290
+            function(Event $event) {
291 291
                 /** @var CraftVariable $variable */
292 292
                 $variable = $event->sender;
293 293
                 $variable->set('imageOptimize', [
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
         Event::on(
302 302
             Fields::class,
303 303
             Fields::EVENT_REGISTER_FIELD_TYPES,
304
-            function (RegisterComponentTypesEvent $event) {
304
+            function(RegisterComponentTypesEvent $event) {
305 305
                 Craft::debug(
306 306
                     'Fields::EVENT_REGISTER_FIELD_TYPES',
307 307
                     __METHOD__
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
             Event::on(
316 316
                 Utilities::class,
317 317
                 Utilities::EVENT_REGISTER_UTILITY_TYPES,
318
-                function (RegisterComponentTypesEvent $event) {
318
+                function(RegisterComponentTypesEvent $event) {
319 319
                     $event->types[] = ImageOptimizeUtility::class;
320 320
                 }
321 321
             );
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
         Event::on(
352 352
             Assets::class,
353 353
             Assets::EVENT_GET_ASSET_URL,
354
-            function (GetAssetUrlEvent $event) {
354
+            function(GetAssetUrlEvent $event) {
355 355
                 Craft::debug(
356 356
                     'Assets::EVENT_GET_ASSET_URL',
357 357
                     __METHOD__
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
         Event::on(
368 368
             Assets::class,
369 369
             Assets::EVENT_GET_ASSET_THUMB_URL,
370
-            function (GetAssetThumbUrlEvent $event) {
370
+            function(GetAssetThumbUrlEvent $event) {
371 371
                 Craft::debug(
372 372
                     'Assets::EVENT_GET_ASSET_THUMB_URL',
373 373
                     __METHOD__
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
         Event::on(
384 384
             AssetTransforms::class,
385 385
             AssetTransforms::EVENT_GENERATE_TRANSFORM,
386
-            function (GenerateTransformEvent $event) {
386
+            function(GenerateTransformEvent $event) {
387 387
                 Craft::debug(
388 388
                     'AssetTransforms::EVENT_GENERATE_TRANSFORM',
389 389
                     __METHOD__
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
         Event::on(
400 400
             AssetTransforms::class,
401 401
             AssetTransforms::EVENT_AFTER_DELETE_TRANSFORMS,
402
-            function (AssetTransformImageEvent $event) {
402
+            function(AssetTransformImageEvent $event) {
403 403
                 Craft::debug(
404 404
                     'AssetTransforms::EVENT_AFTER_DELETE_TRANSFORMS',
405 405
                     __METHOD__
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
         Event::on(
416 416
             Assets::class,
417 417
             Assets::EVENT_BEFORE_REPLACE_ASSET,
418
-            function (ReplaceAssetEvent $event) {
418
+            function(ReplaceAssetEvent $event) {
419 419
                 Craft::debug(
420 420
                     'Assets::EVENT_BEFORE_REPLACE_ASSET',
421 421
                     __METHOD__
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
         Event::on(
435 435
             Assets::class,
436 436
             Assets::EVENT_AFTER_REPLACE_ASSET,
437
-            function (ReplaceAssetEvent $event) {
437
+            function(ReplaceAssetEvent $event) {
438 438
                 Craft::debug(
439 439
                     'Assets::EVENT_AFTER_REPLACE_ASSET',
440 440
                     __METHOD__
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
         Event::on(
458 458
             Assets::class,
459 459
             Elements::EVENT_BEFORE_SAVE_ELEMENT,
460
-            function (ElementEvent $event) {
460
+            function(ElementEvent $event) {
461 461
                 Craft::debug(
462 462
                     'Elements::EVENT_BEFORE_SAVE_ELEMENT',
463 463
                     __METHOD__
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
         Event::on(
479 479
             Asset::class,
480 480
             Elements::EVENT_BEFORE_DELETE_ELEMENT,
481
-            function (ElementEvent $event) {
481
+            function(ElementEvent $event) {
482 482
                 Craft::debug(
483 483
                     'Elements::EVENT_BEFORE_DELETE_ELEMENT',
484 484
                     __METHOD__
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
         Event::on(
504 504
             Fields::class,
505 505
             Fields::EVENT_AFTER_SAVE_FIELD,
506
-            function (FieldEvent $event) {
506
+            function(FieldEvent $event) {
507 507
                 Craft::debug(
508 508
                     'Fields::EVENT_AFTER_SAVE_FIELD',
509 509
                     __METHOD__
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
         Event::on(
521 521
             Plugins::class,
522 522
             Plugins::EVENT_AFTER_SAVE_PLUGIN_SETTINGS,
523
-            function (PluginEvent $event) {
523
+            function(PluginEvent $event) {
524 524
                 if ($event->plugin === $this) {
525 525
                     Craft::debug(
526 526
                         'Plugins::EVENT_AFTER_SAVE_PLUGIN_SETTINGS',
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
         Event::on(
540 540
             Volumes::class,
541 541
             Volumes::EVENT_AFTER_SAVE_VOLUME,
542
-            function (VolumeEvent $event) {
542
+            function(VolumeEvent $event) {
543 543
                 Craft::debug(
544 544
                     'Volumes::EVENT_AFTER_SAVE_VOLUME',
545 545
                     __METHOD__
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
         Event::on(
561 561
             Plugins::class,
562 562
             Plugins::EVENT_AFTER_INSTALL_PLUGIN,
563
-            function (PluginEvent $event) {
563
+            function(PluginEvent $event) {
564 564
                 if ($event->plugin === $this) {
565 565
                     $request = Craft::$app->getRequest();
566 566
                     if ($request->isCpRequest) {
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
         Event::on(
595 595
             UrlManager::class,
596 596
             UrlManager::EVENT_REGISTER_SITE_URL_RULES,
597
-            function (RegisterUrlRulesEvent $event) {
597
+            function(RegisterUrlRulesEvent $event) {
598 598
                 Craft::debug(
599 599
                     'UrlManager::EVENT_REGISTER_SITE_URL_RULES',
600 600
                     __METHOD__
@@ -617,12 +617,12 @@  discard block
 block discarded – undo
617 617
         Event::on(
618 618
             Plugins::class,
619 619
             Plugins::EVENT_AFTER_LOAD_PLUGINS,
620
-            function () {
620
+            function() {
621 621
                     // Install these only after all other plugins have loaded
622 622
                     Event::on(
623 623
                         View::class,
624 624
                         View::EVENT_REGISTER_CP_TEMPLATE_ROOTS,
625
-                        function (RegisterTemplateRootsEvent $e) {
625
+                        function(RegisterTemplateRootsEvent $e) {
626 626
                             // Register the root directodies
627 627
                             $allImageTransformTypes = ImageOptimize::$plugin->optimize->getAllImageTransformTypes();
628 628
                             /** @var ImageTransformInterface $imageTransformType */
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
@@ -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 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -220,11 +220,11 @@
 block discarded – undo
220 220
                 // If the scenario is Asset::SCENARIO_FILEOPS or Asset::SCENARIO_MOVE (if using Craft > v3.7.1) treat it as a new asset
221 221
                 $scenario = $asset->getScenario();
222 222
 
223
-		$supportsMoveScenario = version_compare(
224
-			Craft::$app->getVersion(),
225
-			'3.7.1',
226
-			'>='
227
-		) === true;
223
+        $supportsMoveScenario = version_compare(
224
+            Craft::$app->getVersion(),
225
+            '3.7.1',
226
+            '>='
227
+        ) === true;
228 228
 
229 229
                 if ($isNew || $scenario === Asset::SCENARIO_FILEOPS || ($supportsMoveScenario && $scenario === Asset::SCENARIO_MOVE) ) {
230 230
                     /**
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -226,7 +226,7 @@
 block discarded – undo
226 226
 			'>='
227 227
 		) === true;
228 228
 
229
-                if ($isNew || $scenario === Asset::SCENARIO_FILEOPS || ($supportsMoveScenario && $scenario === Asset::SCENARIO_MOVE) ) {
229
+                if ($isNew || $scenario === Asset::SCENARIO_FILEOPS || ($supportsMoveScenario && $scenario === Asset::SCENARIO_MOVE)) {
230 230
                     /**
231 231
                      * If this is a newly uploaded/created Asset, we can save the variants
232 232
                      * via a queue job to prevent it from blocking
Please login to merge, or discard this patch.