Passed
Push — develop ( 1c6738...b3acc2 )
by Andrew
07:34
created
src/gql/types/generators/OptimizedImagesGenerator.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -261,12 +261,12 @@
 block discarded – undo
261 261
             ?: GqlEntityRegistry::createEntity($typeName, new OptimizedImagesType([
262 262
                 'name' => $typeName,
263 263
                 'description' => 'This entity has all the OptimizedImages properties',
264
-                'fields' => function () use ($optimizedImagesFields) {
264
+                'fields' => function() use ($optimizedImagesFields) {
265 265
                     return $optimizedImagesFields;
266 266
                 },
267 267
             ]));
268 268
 
269
-        TypeLoader::registerType($typeName, function () use ($optimizedImagesType) {
269
+        TypeLoader::registerType($typeName, function() use ($optimizedImagesType) {
270 270
             return $optimizedImagesType;
271 271
         });
272 272
 
Please login to merge, or discard this patch.
src/services/Optimize.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
             $vars,
274 274
             $minifier
275 275
         );
276
-        $content = (string)$content;
276
+        $content = (string) $content;
277 277
         if ($scriptAttrs !== null) {
278 278
             $attrs = array_merge([
279 279
             ],
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
             $vars,
309 309
             $minifier
310 310
         );
311
-        $content = (string)$content;
311
+        $content = (string) $content;
312 312
         if ($scriptAttrs !== null) {
313 313
             $attrs = array_merge([
314 314
             ],
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
                 . '%';
373 373
             Craft::info($message, __METHOD__);
374 374
             if (Craft::$app instanceof ConsoleApplication) {
375
-                echo $message . PHP_EOL;
375
+                echo $message.PHP_EOL;
376 376
             }
377 377
             // Create any image variants
378 378
             $this->createImageVariants(
@@ -410,14 +410,14 @@  discard block
 block discarded – undo
410 410
      */
411 411
     public function saveTransformToTempFile(AssetTransformIndex $index, Image $image): string
412 412
     {
413
-        $tempFilename = uniqid(pathinfo($index->filename, PATHINFO_FILENAME), true) . '.' . $index->detectedFormat;
414
-        $tempPath = Craft::$app->getPath()->getTempPath() . DIRECTORY_SEPARATOR . $tempFilename;
413
+        $tempFilename = uniqid(pathinfo($index->filename, PATHINFO_FILENAME), true).'.'.$index->detectedFormat;
414
+        $tempPath = Craft::$app->getPath()->getTempPath().DIRECTORY_SEPARATOR.$tempFilename;
415 415
         try {
416 416
             $image->saveAs($tempPath);
417 417
         } catch (ImageException $e) {
418
-            Craft::error('Transformed image save failed: ' . $e->getMessage(), __METHOD__);
418
+            Craft::error('Transformed image save failed: '.$e->getMessage(), __METHOD__);
419 419
         }
420
-        Craft::info('Transformed image saved to: ' . $tempPath, __METHOD__);
420
+        Craft::info('Transformed image saved to: '.$tempPath, __METHOD__);
421 421
 
422 422
         return $tempPath;
423 423
     }
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
                             . '%';
530 530
                         Craft::info($message, __METHOD__);
531 531
                         if (Craft::$app instanceof ConsoleApplication) {
532
-                            echo $message . PHP_EOL;
532
+                            echo $message.PHP_EOL;
533 533
                         }
534 534
                         // Copy the image variant into place
535 535
                         $this->copyImageVariantToVolume(
@@ -628,9 +628,9 @@  discard block
 block discarded – undo
628 628
                 // Handle auto-sharpening scaled down images
629 629
                 if ($settings->autoSharpenScaledImages) {
630 630
                     // See if the image has been scaled >= 50%
631
-                    $widthScale = (int)(($image->getWidth() / $asset->getWidth()) * 100);
632
-                    $heightScale = (int)(($image->getHeight() / $asset->getHeight()) * 100);
633
-                    if (($widthScale >= (int)$settings->sharpenScaledImagePercentage) || ($heightScale >= (int)$settings->sharpenScaledImagePercentage)) {
631
+                    $widthScale = (int) (($image->getWidth() / $asset->getWidth()) * 100);
632
+                    $heightScale = (int) (($image->getHeight() / $asset->getHeight()) * 100);
633
+                    if (($widthScale >= (int) $settings->sharpenScaledImagePercentage) || ($heightScale >= (int) $settings->sharpenScaledImagePercentage)) {
634 634
                         $imagineImage->effects()
635 635
                             ->sharpen();
636 636
                         Craft::debug(
@@ -685,7 +685,7 @@  discard block
 block discarded – undo
685 685
                 . escapeshellarg($tempPath);
686 686
             // Execute the command
687 687
             $shellOutput = $this->executeShellCommand($cmd);
688
-            Craft::info($cmd . "\n" . $shellOutput, __METHOD__);
688
+            Craft::info($cmd."\n".$shellOutput, __METHOD__);
689 689
         } else {
690 690
             Craft::error(
691 691
                 $thisProcessor['commandPath']
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
         // Make sure the command exists
738 738
         if (is_file($variantCreatorCommand['commandPath'])) {
739 739
             // Get the output file for this image variant
740
-            $outputPath .= '.' . $variantCreatorCommand['imageVariantExtension'];
740
+            $outputPath .= '.'.$variantCreatorCommand['imageVariantExtension'];
741 741
             // Set any options for the command
742 742
             $commandOptions = '';
743 743
             if (!empty($variantCreatorCommand['commandOptions'])) {
@@ -772,7 +772,7 @@  discard block
 block discarded – undo
772 772
                 . escapeshellarg($tempPath);
773 773
             // Execute the command
774 774
             $shellOutput = $this->executeShellCommand($cmd);
775
-            Craft::info($cmd . "\n" . $shellOutput, __METHOD__);
775
+            Craft::info($cmd."\n".$shellOutput, __METHOD__);
776 776
         } else {
777 777
             Craft::error(
778 778
                 $variantCreatorCommand['commandPath']
@@ -810,23 +810,23 @@  discard block
 block discarded – undo
810 810
                         } catch (InvalidConfigException $e) {
811 811
                             $volume = null;
812 812
                             Craft::error(
813
-                                'Asset volume error: ' . $e->getMessage(),
813
+                                'Asset volume error: '.$e->getMessage(),
814 814
                                 __METHOD__
815 815
                             );
816 816
                         }
817 817
                         try {
818
-                            $variantPath = $asset->getFolder()->path . $assetTransforms->getTransformSubpath(
818
+                            $variantPath = $asset->getFolder()->path.$assetTransforms->getTransformSubpath(
819 819
                                     $asset,
820 820
                                     $transformIndex
821 821
                                 );
822 822
                         } catch (InvalidConfigException $e) {
823 823
                             $variantPath = '';
824 824
                             Craft::error(
825
-                                'Asset folder does not exist: ' . $e->getMessage(),
825
+                                'Asset folder does not exist: '.$e->getMessage(),
826 826
                                 __METHOD__
827 827
                             );
828 828
                         }
829
-                        $variantPath .= '.' . $variantCreatorCommand['imageVariantExtension'];
829
+                        $variantPath .= '.'.$variantCreatorCommand['imageVariantExtension'];
830 830
                         // Delete the variant file in case it is stale
831 831
                         try {
832 832
                             $volume->deleteFile($variantPath);
@@ -834,7 +834,7 @@  discard block
 block discarded – undo
834 834
                             // We're fine with that.
835 835
                         }
836 836
                         Craft::info(
837
-                            'Deleted variant: ' . $variantPath,
837
+                            'Deleted variant: '.$variantPath,
838 838
                             __METHOD__
839 839
                         );
840 840
                     }
@@ -864,21 +864,21 @@  discard block
 block discarded – undo
864 864
             } catch (InvalidConfigException $e) {
865 865
                 $volume = null;
866 866
                 Craft::error(
867
-                    'Asset volume error: ' . $e->getMessage(),
867
+                    'Asset volume error: '.$e->getMessage(),
868 868
                     __METHOD__
869 869
                 );
870 870
             }
871 871
             $assetTransforms = Craft::$app->getAssetTransforms();
872 872
             try {
873
-                $transformPath = $asset->getFolder()->path . $assetTransforms->getTransformSubpath($asset, $index);
873
+                $transformPath = $asset->getFolder()->path.$assetTransforms->getTransformSubpath($asset, $index);
874 874
             } catch (InvalidConfigException $e) {
875 875
                 $transformPath = '';
876 876
                 Craft::error(
877
-                    'Error getting asset folder: ' . $e->getMessage(),
877
+                    'Error getting asset folder: '.$e->getMessage(),
878 878
                     __METHOD__
879 879
                 );
880 880
             }
881
-            $variantPath = $transformPath . '.' . $variantCreatorCommand['imageVariantExtension'];
881
+            $variantPath = $transformPath.'.'.$variantCreatorCommand['imageVariantExtension'];
882 882
 
883 883
             // Delete the variant file in case it is stale
884 884
             try {
@@ -888,7 +888,7 @@  discard block
 block discarded – undo
888 888
             }
889 889
 
890 890
             Craft::info(
891
-                'Variant output path: ' . $outputPath . ' - Variant path: ' . $variantPath,
891
+                'Variant output path: '.$outputPath.' - Variant path: '.$variantPath,
892 892
                 __METHOD__
893 893
             );
894 894
 
@@ -926,9 +926,9 @@  discard block
 block discarded – undo
926 926
     protected function swapPathExtension(string $path, string $extension): string
927 927
     {
928 928
         $pathParts = pathinfo($path);
929
-        $newPath = $pathParts['filename'] . '.' . $extension;
929
+        $newPath = $pathParts['filename'].'.'.$extension;
930 930
         if (!empty($pathParts['dirname']) && $pathParts['dirname'] !== '.') {
931
-            $newPath = $pathParts['dirname'] . DIRECTORY_SEPARATOR . $newPath;
931
+            $newPath = $pathParts['dirname'].DIRECTORY_SEPARATOR.$newPath;
932 932
             $newPath = preg_replace('#/+#', '/', $newPath);
933 933
         }
934 934
 
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/web/assets/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/web/assets/src/js/OptimizedImagesField.js") {'.
331
+            'new Craft.OptimizedImagesInput('.
332
+            '"'.$namespacedId.'", '.
333
+            '"'.$namespacePrefix.'",'.
334
+            '"'.$sizesWrapperId.'"'.
335
+            ');'.
336
+            '}'.
337 337
             '});'
338 338
         );
339 339
 
@@ -407,12 +407,12 @@  discard block
 block discarded – undo
407 407
             $jsonVars = Json::encode($jsonVars);
408 408
             $view = Craft::$app->getView();
409 409
             $view->registerJs(
410
-                'document.addEventListener("vite-script-loaded", function (e) {' .
411
-                'if (e.detail.path === "../src/web/assets/src/js/OptimizedImagesField.js") {' .
412
-                "$('#{$nameSpaceId}-field').ImageOptimizeOptimizedImages(" .
413
-                $jsonVars .
414
-                ");" .
415
-                '}' .
410
+                'document.addEventListener("vite-script-loaded", function (e) {'.
411
+                'if (e.detail.path === "../src/web/assets/src/js/OptimizedImagesField.js") {'.
412
+                "$('#{$nameSpaceId}-field').ImageOptimizeOptimizedImages(".
413
+                $jsonVars.
414
+                ");".
415
+                '}'.
416 416
                 '});'
417 417
             );
418 418
 
Please login to merge, or discard this patch.