Passed
Push — develop-v4 ( 87c832...2540cb )
by Andrew
18:10
created
src/helpers/PluginTemplate.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@
 block discarded – undo
62 62
         string $minifier = null
63 63
     ): string
64 64
     {
65
-        $template = 'image-optimize/' . $templatePath;
65
+        $template = 'image-optimize/'.$templatePath;
66 66
         $oldMode = Craft::$app->view->getTemplateMode();
67 67
         // Look for the template on the frontend first
68 68
         try {
Please login to merge, or discard this patch.
src/helpers/Image.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
         }
60 60
 
61 61
         if (!is_file($path)) {
62
-            Craft::error('Tried to load an image at ' . $path . ', but the file does not exist.', __METHOD__);
62
+            Craft::error('Tried to load an image at '.$path.', but the file does not exist.', __METHOD__);
63 63
             throw new ImageException(Craft::t('app', 'No file exists at the given path.'));
64 64
         }
65 65
 
Please login to merge, or discard this patch.
src/fields/OptimizedImages.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
      * @inheritdoc
188 188
      * @since 1.6.2
189 189
      */
190
-    public function getContentGqlType(): Type|array
190
+    public function getContentGqlType(): Type | array
191 191
     {
192 192
         $typeArray = OptimizedImagesGenerator::generateTypes($this);
193 193
 
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
     /**
277 277
      * @inheritdoc
278 278
      */
279
-    public function getSettingsHtml(): null|string
279
+    public function getSettingsHtml(): null | string
280 280
     {
281 281
         $namespace = Craft::$app->getView()->getNamespace();
282 282
         if (str_contains($namespace, Matrix::class) || str_contains($namespace, SuperTableField::class)) {
@@ -312,14 +312,14 @@  discard block
 block discarded – undo
312 312
         $sizesWrapperId = Craft::$app->getView()->namespaceInputId('sizes-wrapper');
313 313
         $view = Craft::$app->getView();
314 314
         $view->registerJs(
315
-            'document.addEventListener("vite-script-loaded", function (e) {' .
316
-            'if (e.detail.path === "../src/web/assets/src/js/OptimizedImagesField.js") {' .
317
-            'new Craft.OptimizedImagesInput(' .
318
-            '"' . $namespacedId . '", ' .
319
-            '"' . $namespacePrefix . '",' .
320
-            '"' . $sizesWrapperId . '"' .
321
-            ');' .
322
-            '}' .
315
+            'document.addEventListener("vite-script-loaded", function (e) {'.
316
+            'if (e.detail.path === "../src/web/assets/src/js/OptimizedImagesField.js") {'.
317
+            'new Craft.OptimizedImagesInput('.
318
+            '"'.$namespacedId.'", '.
319
+            '"'.$namespacePrefix.'",'.
320
+            '"'.$sizesWrapperId.'"'.
321
+            ');'.
322
+            '}'.
323 323
             '});'
324 324
         );
325 325
 
@@ -387,12 +387,12 @@  discard block
 block discarded – undo
387 387
             $jsonVars = Json::encode($jsonVars);
388 388
             $view = Craft::$app->getView();
389 389
             $view->registerJs(
390
-                'document.addEventListener("vite-script-loaded", function (e) {' .
391
-                'if (e.detail.path === "../src/web/assets/src/js/OptimizedImagesField.js") {' .
392
-                "$('#{$nameSpaceId}-field').ImageOptimizeOptimizedImages(" .
393
-                $jsonVars .
394
-                ");" .
395
-                '}' .
390
+                'document.addEventListener("vite-script-loaded", function (e) {'.
391
+                'if (e.detail.path === "../src/web/assets/src/js/OptimizedImagesField.js") {'.
392
+                "$('#{$nameSpaceId}-field').ImageOptimizeOptimizedImages(".
393
+                $jsonVars.
394
+                ");".
395
+                '}'.
396 396
                 '});'
397 397
             );
398 398
 
Please login to merge, or discard this patch.
src/validators/EmbeddedModelValidator.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
                         $model->addError(
42 42
                             $attribute,
43 43
                             Craft::t('image-optimize', 'Object failed to validate')
44
-                            . '-' . $attributeError . ' - ' . $valueError
44
+                            . '-'.$attributeError.' - '.$valueError
45 45
                         );
46 46
                     }
47 47
                 }
Please login to merge, or discard this patch.
src/jobs/ResaveOptimizedImages.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
             Craft::configure($query, $this->criteria);
76 76
         }
77 77
         if (Craft::$app instanceof ConsoleApplication) {
78
-            echo $this->description . PHP_EOL;
78
+            echo $this->description.PHP_EOL;
79 79
         }
80 80
         // Use craft\db\Paginator to paginate the results so we don't exceed any memory limits
81 81
         // See batch() and each() discussion here: https://github.com/yiisoft/yii2/issues/8420
@@ -89,8 +89,8 @@  discard block
 block discarded – undo
89 89
         while ($currentElement < $totalElements) {
90 90
             $elements = $paginator->getPageResults();
91 91
             if (Craft::$app instanceof ConsoleApplication) {
92
-                echo 'Query ' . $paginator->getCurrentPage() . '/' . $paginator->getTotalPages()
93
-                    . ' - assets: ' . $paginator->getTotalResults()
92
+                echo 'Query '.$paginator->getCurrentPage().'/'.$paginator->getTotalPages()
93
+                    . ' - assets: '.$paginator->getTotalResults()
94 94
                     . PHP_EOL;
95 95
             }
96 96
             /** @var ElementInterface $element */
@@ -103,11 +103,11 @@  discard block
 block discarded – undo
103 103
                     /** @var  $field Field */
104 104
                     foreach ($fields as $field) {
105 105
                         if ($field instanceof OptimizedImagesField && $element instanceof Asset) {
106
-                            if ($this->fieldId === null || (int)$field->id === (int)$this->fieldId) {
106
+                            if ($this->fieldId === null || (int) $field->id === (int) $this->fieldId) {
107 107
                                 if (Craft::$app instanceof ConsoleApplication) {
108
-                                    echo $currentElement . '/' . $totalElements
109
-                                        . ' - processing asset: ' . $element->title
110
-                                        . ' from field: ' . $field->name . PHP_EOL;
108
+                                    echo $currentElement.'/'.$totalElements
109
+                                        . ' - processing asset: '.$element->title
110
+                                        . ' from field: '.$field->name.PHP_EOL;
111 111
                                 }
112 112
                                 try {
113 113
                                     ImageOptimize::$plugin->optimizedImages->updateOptimizedImageFieldData($field, $element, $this->force);
@@ -117,9 +117,9 @@  discard block
 block discarded – undo
117 117
                                         echo '[error]: '
118 118
                                             . $e->getMessage()
119 119
                                             . ' while processing '
120
-                                            . $currentElement . '/' . $totalElements
121
-                                            . ' - processing asset: ' . $element->title
122
-                                            . ' from field: ' . $field->name . PHP_EOL;
120
+                                            . $currentElement.'/'.$totalElements
121
+                                            . ' - processing asset: '.$element->title
122
+                                            . ' from field: '.$field->name.PHP_EOL;
123 123
                                     }
124 124
                                 }
125 125
                             }
Please login to merge, or discard this patch.
src/ImageOptimize.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
     /**
167 167
      * @inheritdoc
168 168
      */
169
-    public function getSettingsResponse(): TemplateResponseBehavior|Response
169
+    public function getSettingsResponse(): TemplateResponseBehavior | Response
170 170
     {
171 171
         $view = Craft::$app->getView();
172 172
         $namespace = $view->getNamespace();
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
         Event::on(
266 266
             CraftVariable::class,
267 267
             CraftVariable::EVENT_INIT,
268
-            function (Event $event) {
268
+            function(Event $event) {
269 269
                 /** @var CraftVariable $variable */
270 270
                 $variable = $event->sender;
271 271
                 $variable->set('imageOptimize', [
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
         Event::on(
280 280
             Fields::class,
281 281
             Fields::EVENT_REGISTER_FIELD_TYPES,
282
-            static function (RegisterComponentTypesEvent $event) {
282
+            static function(RegisterComponentTypesEvent $event) {
283 283
                 Craft::debug(
284 284
                     'Fields::EVENT_REGISTER_FIELD_TYPES',
285 285
                     __METHOD__
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
             Event::on(
294 294
                 Utilities::class,
295 295
                 Utilities::EVENT_REGISTER_UTILITY_TYPES,
296
-                static function (RegisterComponentTypesEvent $event) {
296
+                static function(RegisterComponentTypesEvent $event) {
297 297
                     $event->types[] = ImageOptimizeUtility::class;
298 298
                 }
299 299
             );
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
         Event::on(
329 329
             Asset::class,
330 330
             Asset::EVENT_DEFINE_URL,
331
-            static function (DefineAssetUrlEvent $event): void {
331
+            static function(DefineAssetUrlEvent $event): void {
332 332
                 Craft::debug(
333 333
                     'Asset::EVENT_GET_ASSET_URL',
334 334
                     __METHOD__
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
         Event::on(
345 345
             Assets::class,
346 346
             Assets::EVENT_DEFINE_THUMB_URL,
347
-            static function (DefineAssetThumbUrlEvent $event): void {
347
+            static function(DefineAssetThumbUrlEvent $event): void {
348 348
                 Craft::debug(
349 349
                     'Assets::EVENT_DEFINE_THUMB_URL',
350 350
                     __METHOD__
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
         Event::on(
361 361
             ImageTransformer::class,
362 362
             ImageTransformer::EVENT_TRANSFORM_IMAGE,
363
-            static function (ImageTransformerOperationEvent $event): void {
363
+            static function(ImageTransformerOperationEvent $event): void {
364 364
                 Craft::debug(
365 365
                     'ImageTransformer::EVENT_TRANSFORM_IMAGE',
366 366
                     __METHOD__
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
         Event::on(
377 377
             ImageTransformer::class,
378 378
             ImageTransformer::EVENT_DELETE_TRANSFORMED_IMAGE,
379
-            static function (ImageTransformerOperationEvent $event): void {
379
+            static function(ImageTransformerOperationEvent $event): void {
380 380
                 Craft::debug(
381 381
                     'ImageTransformer::EVENT_DELETE_TRANSFORMED_IMAGE',
382 382
                     __METHOD__
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
         Event::on(
393 393
             Assets::class,
394 394
             Assets::EVENT_BEFORE_REPLACE_ASSET,
395
-            static function (ReplaceAssetEvent $event) {
395
+            static function(ReplaceAssetEvent $event) {
396 396
                 Craft::debug(
397 397
                     'Assets::EVENT_BEFORE_REPLACE_ASSET',
398 398
                     __METHOD__
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
         Event::on(
411 411
             Assets::class,
412 412
             Assets::EVENT_AFTER_REPLACE_ASSET,
413
-            static function (ReplaceAssetEvent $event) {
413
+            static function(ReplaceAssetEvent $event) {
414 414
                 Craft::debug(
415 415
                     'Assets::EVENT_AFTER_REPLACE_ASSET',
416 416
                     __METHOD__
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
         Event::on(
433 433
             Assets::class,
434 434
             Elements::EVENT_BEFORE_SAVE_ELEMENT,
435
-            static function (ElementEvent $event) {
435
+            static function(ElementEvent $event) {
436 436
                 Craft::debug(
437 437
                     'Elements::EVENT_BEFORE_SAVE_ELEMENT',
438 438
                     __METHOD__
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
         Event::on(
454 454
             Asset::class,
455 455
             Elements::EVENT_BEFORE_DELETE_ELEMENT,
456
-            static function (ElementEvent $event) {
456
+            static function(ElementEvent $event) {
457 457
                 Craft::debug(
458 458
                     'Elements::EVENT_BEFORE_DELETE_ELEMENT',
459 459
                     __METHOD__
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
         Event::on(
479 479
             Fields::class,
480 480
             Fields::EVENT_AFTER_SAVE_FIELD,
481
-            function (FieldEvent $event) {
481
+            function(FieldEvent $event) {
482 482
                 Craft::debug(
483 483
                     'Fields::EVENT_AFTER_SAVE_FIELD',
484 484
                     __METHOD__
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
         Event::on(
497 497
             Plugins::class,
498 498
             Plugins::EVENT_AFTER_SAVE_PLUGIN_SETTINGS,
499
-            function (PluginEvent $event) {
499
+            function(PluginEvent $event) {
500 500
                 if ($event->plugin === $this) {
501 501
                     Craft::debug(
502 502
                         'Plugins::EVENT_AFTER_SAVE_PLUGIN_SETTINGS',
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
         Event::on(
517 517
             Volumes::class,
518 518
             Volumes::EVENT_AFTER_SAVE_VOLUME,
519
-            function (VolumeEvent $event) {
519
+            function(VolumeEvent $event) {
520 520
                 Craft::debug(
521 521
                     'Volumes::EVENT_AFTER_SAVE_VOLUME',
522 522
                     __METHOD__
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
         Event::on(
536 536
             Plugins::class,
537 537
             Plugins::EVENT_AFTER_INSTALL_PLUGIN,
538
-            function (PluginEvent $event) {
538
+            function(PluginEvent $event) {
539 539
                 if ($event->plugin === $this) {
540 540
                     $request = Craft::$app->getRequest();
541 541
                     if ($request->isCpRequest) {
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
         Event::on(
556 556
             UrlManager::class,
557 557
             UrlManager::EVENT_REGISTER_SITE_URL_RULES,
558
-            function (RegisterUrlRulesEvent $event) {
558
+            function(RegisterUrlRulesEvent $event) {
559 559
                 Craft::debug(
560 560
                     'UrlManager::EVENT_REGISTER_SITE_URL_RULES',
561 561
                     __METHOD__
@@ -578,12 +578,12 @@  discard block
 block discarded – undo
578 578
         Event::on(
579 579
             Plugins::class,
580 580
             Plugins::EVENT_AFTER_LOAD_PLUGINS,
581
-            static function () {
581
+            static function() {
582 582
                 // Install these only after all other plugins have loaded
583 583
                 Event::on(
584 584
                     View::class,
585 585
                     View::EVENT_REGISTER_CP_TEMPLATE_ROOTS,
586
-                    static function (RegisterTemplateRootsEvent $e) {
586
+                    static function(RegisterTemplateRootsEvent $e) {
587 587
                         // Register the root directodies
588 588
                         $allImageTransformTypes = ImageOptimize::$plugin->optimize->getAllImageTransformTypes();
589 589
                         /** @var ImageTransformInterface $imageTransformType */
Please login to merge, or discard this patch.
src/gql/types/generators/OptimizedImagesGenerator.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -259,12 +259,12 @@  discard block
 block discarded – undo
259 259
             ?: GqlEntityRegistry::createEntity($typeName, new OptimizedImagesType([
260 260
                 'name' => $typeName,
261 261
                 'description' => 'This entity has all the OptimizedImages properties',
262
-                'fields' => function () use ($optimizedImagesFields) {
262
+                'fields' => function() use ($optimizedImagesFields) {
263 263
                     return $optimizedImagesFields;
264 264
                 },
265 265
             ]));
266 266
 
267
-        TypeLoader::registerType($typeName, function () use ($optimizedImagesType) {
267
+        TypeLoader::registerType($typeName, function() use ($optimizedImagesType) {
268 268
             return $optimizedImagesType;
269 269
         });
270 270
 
@@ -277,6 +277,6 @@  discard block
 block discarded – undo
277 277
     public static function getName($context = null): string
278 278
     {
279 279
         /** @var OptimizedImages $context */
280
-        return $context->handle . '_OptimizedImages';
280
+        return $context->handle.'_OptimizedImages';
281 281
     }
282 282
 }
Please login to merge, or discard this patch.
src/services/Optimize.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
      *
120 120
      * @return ?ImageTransformInterface The Image Transform
121 121
      */
122
-    public function createImageTransformType(string|array $config): ?ImageTransformInterface
122
+    public function createImageTransformType(string | array $config): ?ImageTransformInterface
123 123
     {
124 124
         if (is_string($config)) {
125 125
             $config = ['type' => $config];
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
                 . '%';
389 389
             Craft::info($message, __METHOD__);
390 390
             if (Craft::$app instanceof ConsoleApplication) {
391
-                echo $message . PHP_EOL;
391
+                echo $message.PHP_EOL;
392 392
             }
393 393
             // Create any image variants
394 394
             $this->createImageVariants(
@@ -426,14 +426,14 @@  discard block
 block discarded – undo
426 426
      */
427 427
     public function saveTransformToTempFile(AssetTransformIndex $index, Image $image): string
428 428
     {
429
-        $tempFilename = uniqid(pathinfo($index->filename, PATHINFO_FILENAME), true) . '.' . $index->detectedFormat;
430
-        $tempPath = Craft::$app->getPath()->getTempPath() . DIRECTORY_SEPARATOR . $tempFilename;
429
+        $tempFilename = uniqid(pathinfo($index->filename, PATHINFO_FILENAME), true).'.'.$index->detectedFormat;
430
+        $tempPath = Craft::$app->getPath()->getTempPath().DIRECTORY_SEPARATOR.$tempFilename;
431 431
         try {
432 432
             $image->saveAs($tempPath);
433 433
         } catch (ImageException $e) {
434
-            Craft::error('Transformed image save failed: ' . $e->getMessage(), __METHOD__);
434
+            Craft::error('Transformed image save failed: '.$e->getMessage(), __METHOD__);
435 435
         }
436
-        Craft::info('Transformed image saved to: ' . $tempPath, __METHOD__);
436
+        Craft::info('Transformed image saved to: '.$tempPath, __METHOD__);
437 437
 
438 438
         return $tempPath;
439 439
     }
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
                             . '%';
547 547
                         Craft::info($message, __METHOD__);
548 548
                         if (Craft::$app instanceof ConsoleApplication) {
549
-                            echo $message . PHP_EOL;
549
+                            echo $message.PHP_EOL;
550 550
                         }
551 551
                         // Copy the image variant into place
552 552
                         $this->copyImageVariantToVolume(
@@ -644,8 +644,8 @@  discard block
 block discarded – undo
644 644
             // Handle auto-sharpening scaled down images
645 645
             if ($imagineImage !== null && $settings->autoSharpenScaledImages) {
646 646
                 // See if the image has been scaled >= 50%
647
-                $widthScale = (int)(($image->getWidth() / $asset->getWidth()) * 100);
648
-                $heightScale = (int)(($image->getHeight() / $asset->getHeight()) * 100);
647
+                $widthScale = (int) (($image->getWidth() / $asset->getWidth()) * 100);
648
+                $heightScale = (int) (($image->getHeight() / $asset->getHeight()) * 100);
649 649
                 if (($widthScale >= $settings->sharpenScaledImagePercentage) || ($heightScale >= $settings->sharpenScaledImagePercentage)) {
650 650
                     $imagineImage->effects()
651 651
                         ->sharpen();
@@ -700,7 +700,7 @@  discard block
 block discarded – undo
700 700
                 . escapeshellarg($tempPath);
701 701
             // Execute the command
702 702
             $shellOutput = $this->executeShellCommand($cmd);
703
-            Craft::info($cmd . "\n" . $shellOutput, __METHOD__);
703
+            Craft::info($cmd."\n".$shellOutput, __METHOD__);
704 704
         } else {
705 705
             Craft::error(
706 706
                 $thisProcessor['commandPath']
@@ -752,7 +752,7 @@  discard block
 block discarded – undo
752 752
         // Make sure the command exists
753 753
         if (is_file($variantCreatorCommand['commandPath'])) {
754 754
             // Get the output file for this image variant
755
-            $outputPath .= '.' . $variantCreatorCommand['imageVariantExtension'];
755
+            $outputPath .= '.'.$variantCreatorCommand['imageVariantExtension'];
756 756
             // Set any options for the command
757 757
             $commandOptions = '';
758 758
             if (!empty($variantCreatorCommand['commandOptions'])) {
@@ -787,7 +787,7 @@  discard block
 block discarded – undo
787 787
                 . escapeshellarg($tempPath);
788 788
             // Execute the command
789 789
             $shellOutput = $this->executeShellCommand($cmd);
790
-            Craft::info($cmd . "\n" . $shellOutput, __METHOD__);
790
+            Craft::info($cmd."\n".$shellOutput, __METHOD__);
791 791
         } else {
792 792
             Craft::error(
793 793
                 $variantCreatorCommand['commandPath']
@@ -832,17 +832,17 @@  discard block
 block discarded – undo
832 832
                         } catch (InvalidConfigException $invalidConfigException) {
833 833
                             $fs = null;
834 834
                             Craft::error(
835
-                                'Asset file system error: ' . $invalidConfigException->getMessage(),
835
+                                'Asset file system error: '.$invalidConfigException->getMessage(),
836 836
                                 __METHOD__
837 837
                             );
838 838
                         }
839 839
 
840
-                        $variantPath = $uri . '.' . $variantCreatorCommand['imageVariantExtension'];
840
+                        $variantPath = $uri.'.'.$variantCreatorCommand['imageVariantExtension'];
841 841
 
842 842
                         // Delete the variant file in case it is stale
843 843
                         $fs->deleteFile($variantPath);
844 844
                         Craft::info(
845
-                            'Deleted variant: ' . $variantPath,
845
+                            'Deleted variant: '.$variantPath,
846 846
                             __METHOD__
847 847
                         );
848 848
                     }
@@ -875,17 +875,17 @@  discard block
 block discarded – undo
875 875
             } catch (InvalidConfigException $e) {
876 876
                 $fs = null;
877 877
                 Craft::error(
878
-                    'Asset volume error: ' . $e->getMessage(),
878
+                    'Asset volume error: '.$e->getMessage(),
879 879
                     __METHOD__
880 880
                 );
881 881
             }
882 882
 
883
-            $variantPath = $uri . '.' . $variantCreatorCommand['imageVariantExtension'];
883
+            $variantPath = $uri.'.'.$variantCreatorCommand['imageVariantExtension'];
884 884
 
885 885
             // Delete the variant file in case it is stale
886 886
             $fs->deleteFile($variantPath);
887 887
             Craft::info(
888
-                'Variant output path: ' . $outputPath . ' - Variant path: ' . $variantPath,
888
+                'Variant output path: '.$outputPath.' - Variant path: '.$variantPath,
889 889
                 __METHOD__
890 890
             );
891 891
             clearstatcache(true, $outputPath);
@@ -913,9 +913,9 @@  discard block
 block discarded – undo
913 913
     protected function swapPathExtension(string $path, string $extension): string
914 914
     {
915 915
         $pathParts = pathinfo($path);
916
-        $newPath = $pathParts['filename'] . '.' . $extension;
916
+        $newPath = $pathParts['filename'].'.'.$extension;
917 917
         if (!empty($pathParts['dirname']) && $pathParts['dirname'] !== '.') {
918
-            $newPath = $pathParts['dirname'] . DIRECTORY_SEPARATOR . $newPath;
918
+            $newPath = $pathParts['dirname'].DIRECTORY_SEPARATOR.$newPath;
919 919
             $newPath = preg_replace('#/+#', '/', $newPath);
920 920
         }
921 921
 
Please login to merge, or discard this patch.
src/services/Placeholder.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
             . "style='background:$color' "
70 70
             . "/>";
71 71
 
72
-        return $header . ImageOptimize::$plugin->optimizedImages->encodeOptimizedSVGDataUri($content);
72
+        return $header.ImageOptimize::$plugin->optimizedImages->encodeOptimizedSVGDataUri($content);
73 73
     }
74 74
 
75 75
     /**
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
         );
91 91
         $result = '';
92 92
         $width = self::PLACEHOLDER_WIDTH;
93
-        $height = (int)($width / $aspectRatio);
93
+        $height = (int) ($width / $aspectRatio);
94 94
         $placeholderPath = $this->createImageFromPath($tempPath, $width, $height, self::PLACEHOLDER_QUALITY, $position);
95 95
         if (!empty($placeholderPath)) {
96 96
             $result = base64_encode(file_get_contents($placeholderPath));
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
     {
113 113
         Craft::beginProfile('generateColorPalette', __METHOD__);
114 114
         Craft::info(
115
-            'Generating color palette for: ' . $tempPath,
115
+            'Generating color palette for: '.$tempPath,
116 116
             __METHOD__
117 117
         );
118 118
         $colorPalette = [];
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
      *
141 141
      * @return float|int|null
142 142
      */
143
-    public function calculateLightness(array $colors): float|int|null
143
+    public function calculateLightness(array $colors): float | int | null
144 144
     {
145 145
         $lightness = null;
146 146
         if (!empty($colors)) {
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
             $lightness /= $colorCount;
159 159
         }
160 160
 
161
-        return $lightness === null ? $lightness : (int)$lightness;
161
+        return $lightness === null ? $lightness : (int) $lightness;
162 162
     }
163 163
 
164 164
     /**
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
             __METHOD__
224 224
         );
225 225
         $width = self::TEMP_PLACEHOLDER_WIDTH;
226
-        $height = (int)($width / $aspectRatio);
226
+        $height = (int) ($width / $aspectRatio);
227 227
         $tempPath = $this->createImageFromAsset($asset, $width, $height, self::TEMP_PLACEHOLDER_QUALITY, $position);
228 228
         Craft::endProfile('createTempPlaceholderImage', __METHOD__);
229 229
 
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
             }
280 280
         } catch (Throwable $e) {
281 281
             Craft::error(
282
-                'Error creating temporary image: ' . $e->getMessage(),
282
+                'Error creating temporary image: '.$e->getMessage(),
283 283
                 __METHOD__
284 284
             );
285 285
 
@@ -300,14 +300,14 @@  discard block
 block discarded – undo
300 300
         }
301 301
 
302 302
         // Save the image out to a temp file, then return its contents
303
-        $tempFilename = uniqid(pathinfo($pathParts['filename'], PATHINFO_FILENAME), true) . '.' . 'jpg';
304
-        $tempPath = Craft::$app->getPath()->getTempPath() . DIRECTORY_SEPARATOR . $tempFilename;
303
+        $tempFilename = uniqid(pathinfo($pathParts['filename'], PATHINFO_FILENAME), true).'.'.'jpg';
304
+        $tempPath = Craft::$app->getPath()->getTempPath().DIRECTORY_SEPARATOR.$tempFilename;
305 305
         clearstatcache(true, $tempPath);
306 306
         try {
307 307
             $image->saveAs($tempPath);
308 308
         } catch (Throwable $e) {
309 309
             Craft::error(
310
-                'Error saving temporary image: ' . $e->getMessage(),
310
+                'Error saving temporary image: '.$e->getMessage(),
311 311
                 __METHOD__
312 312
             );
313 313
         }
Please login to merge, or discard this patch.