@@ -273,7 +273,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | |
@@ -326,14 +326,14 @@ discard block |
||
| 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 |
||
| 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 | |
@@ -59,7 +59,7 @@ |
||
| 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 | |
@@ -41,7 +41,7 @@ |
||
| 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 | } |
@@ -264,7 +264,7 @@ |
||
| 264 | 264 | int $width, |
| 265 | 265 | int $height, |
| 266 | 266 | int $quality, |
| 267 | - $position |
|
| 267 | + $position |
|
| 268 | 268 | ): string |
| 269 | 269 | { |
| 270 | 270 | $images = Craft::$app->getImages(); |
@@ -69,7 +69,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 = []; |
@@ -158,7 +158,7 @@ discard block |
||
| 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 | /** |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | __METHOD__ |
| 225 | 225 | ); |
| 226 | 226 | $width = self::TEMP_PLACEHOLDER_WIDTH; |
| 227 | - $height = (int)($width / $aspectRatio); |
|
| 227 | + $height = (int) ($width / $aspectRatio); |
|
| 228 | 228 | $tempPath = $this->createImageFromAsset($asset, $width, $height, self::TEMP_PLACEHOLDER_QUALITY, $position); |
| 229 | 229 | Craft::endProfile('createTempPlaceholderImage', __METHOD__); |
| 230 | 230 | |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | } |
| 281 | 281 | } catch (Throwable $e) { |
| 282 | 282 | Craft::error( |
| 283 | - 'Error creating temporary image: ' . $e->getMessage(), |
|
| 283 | + 'Error creating temporary image: '.$e->getMessage(), |
|
| 284 | 284 | __METHOD__ |
| 285 | 285 | ); |
| 286 | 286 | |
@@ -303,14 +303,14 @@ discard block |
||
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | // Save the image out to a temp file, then return its contents |
| 306 | - $tempFilename = uniqid(pathinfo($pathParts['filename'], PATHINFO_FILENAME), true) . '.' . 'jpg'; |
|
| 307 | - $tempPath = Craft::$app->getPath()->getTempPath() . DIRECTORY_SEPARATOR . $tempFilename; |
|
| 306 | + $tempFilename = uniqid(pathinfo($pathParts['filename'], PATHINFO_FILENAME), true).'.'.'jpg'; |
|
| 307 | + $tempPath = Craft::$app->getPath()->getTempPath().DIRECTORY_SEPARATOR.$tempFilename; |
|
| 308 | 308 | clearstatcache(true, $tempPath); |
| 309 | 309 | try { |
| 310 | 310 | $image->saveAs($tempPath); |
| 311 | 311 | } catch (Throwable $e) { |
| 312 | 312 | Craft::error( |
| 313 | - 'Error saving temporary image: ' . $e->getMessage(), |
|
| 313 | + 'Error saving temporary image: '.$e->getMessage(), |
|
| 314 | 314 | __METHOD__ |
| 315 | 315 | ); |
| 316 | 316 | } |
@@ -79,8 +79,8 @@ |
||
| 79 | 79 | */ |
| 80 | 80 | public function createOptimizedImages( |
| 81 | 81 | Asset $asset, |
| 82 | - $variants = null, |
|
| 83 | - $generatePlaceholders = false |
|
| 82 | + $variants = null, |
|
| 83 | + $generatePlaceholders = false |
|
| 84 | 84 | ) |
| 85 | 85 | { |
| 86 | 86 | // Override our settings for lengthy operations, since we're doing this via Twig |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | Craft::configure($query, $this->criteria); |
| 82 | 82 | } |
| 83 | 83 | if (Craft::$app instanceof ConsoleApplication) { |
| 84 | - echo $this->description . PHP_EOL; |
|
| 84 | + echo $this->description.PHP_EOL; |
|
| 85 | 85 | } |
| 86 | 86 | // Use craft\db\Paginator to paginate the results so we don't exceed any memory limits |
| 87 | 87 | // See batch() and each() discussion here: https://github.com/yiisoft/yii2/issues/8420 |
@@ -95,8 +95,8 @@ discard block |
||
| 95 | 95 | while ($currentElement < $totalElements) { |
| 96 | 96 | $elements = $paginator->getPageResults(); |
| 97 | 97 | if (Craft::$app instanceof ConsoleApplication) { |
| 98 | - echo 'Query ' . $paginator->getCurrentPage() . '/' . $paginator->getTotalPages() |
|
| 99 | - . ' - assets: ' . $paginator->getTotalResults() |
|
| 98 | + echo 'Query '.$paginator->getCurrentPage().'/'.$paginator->getTotalPages() |
|
| 99 | + . ' - assets: '.$paginator->getTotalResults() |
|
| 100 | 100 | . PHP_EOL; |
| 101 | 101 | } |
| 102 | 102 | /** @var ElementInterface $element */ |
@@ -111,9 +111,9 @@ discard block |
||
| 111 | 111 | if ($field instanceof OptimizedImagesField && $element instanceof Asset) { |
| 112 | 112 | if ($this->fieldId === null || $field->id == $this->fieldId) { |
| 113 | 113 | if (Craft::$app instanceof ConsoleApplication) { |
| 114 | - echo $currentElement . '/' . $totalElements |
|
| 115 | - . ' - processing asset: ' . $element->title |
|
| 116 | - . ' from field: ' . $field->name . PHP_EOL; |
|
| 114 | + echo $currentElement.'/'.$totalElements |
|
| 115 | + . ' - processing asset: '.$element->title |
|
| 116 | + . ' from field: '.$field->name.PHP_EOL; |
|
| 117 | 117 | } |
| 118 | 118 | try { |
| 119 | 119 | ImageOptimize::$plugin->optimizedImages->updateOptimizedImageFieldData($field, $element, $this->force); |
@@ -123,9 +123,9 @@ discard block |
||
| 123 | 123 | echo '[error]: ' |
| 124 | 124 | . $e->getMessage() |
| 125 | 125 | . ' while processing ' |
| 126 | - . $currentElement . '/' . $totalElements |
|
| 127 | - . ' - processing asset: ' . $element->title |
|
| 128 | - . ' from field: ' . $field->name . PHP_EOL; |
|
| 126 | + . $currentElement.'/'.$totalElements |
|
| 127 | + . ' - processing asset: '.$element->title |
|
| 128 | + . ' from field: '.$field->name.PHP_EOL; |
|
| 129 | 129 | } |
| 130 | 130 | } |
| 131 | 131 | } |
@@ -548,7 +548,7 @@ discard block |
||
| 548 | 548 | return $this->defaultPlaceholderImage(); |
| 549 | 549 | } |
| 550 | 550 | |
| 551 | - return Template::raw($header . rawurlencode($content)); |
|
| 551 | + return Template::raw($header.rawurlencode($content)); |
|
| 552 | 552 | } |
| 553 | 553 | |
| 554 | 554 | /** |
@@ -558,7 +558,7 @@ discard block |
||
| 558 | 558 | */ |
| 559 | 559 | public function getPlaceholderImage(): string |
| 560 | 560 | { |
| 561 | - return (string)$this->placeholderImage(); |
|
| 561 | + return (string) $this->placeholderImage(); |
|
| 562 | 562 | } |
| 563 | 563 | |
| 564 | 564 | /** |
@@ -595,7 +595,7 @@ discard block |
||
| 595 | 595 | */ |
| 596 | 596 | public function getPlaceholderBox(string $color = null): string |
| 597 | 597 | { |
| 598 | - return (string)$this->placeholderBox($color); |
|
| 598 | + return (string) $this->placeholderBox($color); |
|
| 599 | 599 | } |
| 600 | 600 | |
| 601 | 601 | /** |
@@ -626,7 +626,7 @@ discard block |
||
| 626 | 626 | return $this->defaultPlaceholderImage(); |
| 627 | 627 | } |
| 628 | 628 | |
| 629 | - return Template::raw($header . $content); |
|
| 629 | + return Template::raw($header.$content); |
|
| 630 | 630 | } |
| 631 | 631 | |
| 632 | 632 | /** |
@@ -636,7 +636,7 @@ discard block |
||
| 636 | 636 | */ |
| 637 | 637 | public function getPlaceholderSilhouette(): string |
| 638 | 638 | { |
| 639 | - return (string)$this->placeholderSilhouette(); |
|
| 639 | + return (string) $this->placeholderSilhouette(); |
|
| 640 | 640 | } |
| 641 | 641 | |
| 642 | 642 | /** |
@@ -752,16 +752,16 @@ discard block |
||
| 752 | 752 | foreach ($array as $key => $value) { |
| 753 | 753 | if ($dpr) { |
| 754 | 754 | $descriptor = '1x'; |
| 755 | - if (!empty($array[(int)$key / 2])) { |
|
| 755 | + if (!empty($array[(int) $key / 2])) { |
|
| 756 | 756 | $descriptor = '2x'; |
| 757 | 757 | } |
| 758 | - if (!empty($array[(int)$key / 3])) { |
|
| 758 | + if (!empty($array[(int) $key / 3])) { |
|
| 759 | 759 | $descriptor = '3x'; |
| 760 | 760 | } |
| 761 | 761 | } else { |
| 762 | - $descriptor = $key . 'w'; |
|
| 762 | + $descriptor = $key.'w'; |
|
| 763 | 763 | } |
| 764 | - $srcset .= $value . ' ' . $descriptor . ', '; |
|
| 764 | + $srcset .= $value.' '.$descriptor.', '; |
|
| 765 | 765 | } |
| 766 | 766 | $srcset = rtrim($srcset, ', '); |
| 767 | 767 | |
@@ -796,13 +796,13 @@ discard block |
||
| 796 | 796 | { |
| 797 | 797 | // Set the class and loading attributes |
| 798 | 798 | if (isset($attrs['class'])) { |
| 799 | - $attrs['class'] = trim($attrs['class'] . ' lazyload'); |
|
| 799 | + $attrs['class'] = trim($attrs['class'].' lazyload'); |
|
| 800 | 800 | } |
| 801 | 801 | // Set the style on this element to be the placeholder image as the background-image |
| 802 | 802 | if (isset($attrs['style']) && !empty($attrs['src'])) { |
| 803 | 803 | $attrs['style'] = trim( |
| 804 | - $attrs['style'] . |
|
| 805 | - 'background-image:url(' . $this->getLazyLoadSrc($placeHolder) . '); background-size: cover;' |
|
| 804 | + $attrs['style']. |
|
| 805 | + 'background-image:url('.$this->getLazyLoadSrc($placeHolder).'); background-size: cover;' |
|
| 806 | 806 | ); |
| 807 | 807 | } |
| 808 | 808 | // Handle attributes that lazy and lazySizesFallback have in common |
@@ -37,12 +37,12 @@ discard block |
||
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | if (strlen($htmlCode) === 3) { |
| 40 | - $htmlCode = $htmlCode[0] . $htmlCode[0] . $htmlCode[1] . $htmlCode[1] . $htmlCode[2] . $htmlCode[2]; |
|
| 40 | + $htmlCode = $htmlCode[0].$htmlCode[0].$htmlCode[1].$htmlCode[1].$htmlCode[2].$htmlCode[2]; |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - $r = hexdec($htmlCode[0] . $htmlCode[1]); |
|
| 44 | - $g = hexdec($htmlCode[2] . $htmlCode[3]); |
|
| 45 | - $b = hexdec($htmlCode[4] . $htmlCode[5]); |
|
| 43 | + $r = hexdec($htmlCode[0].$htmlCode[1]); |
|
| 44 | + $g = hexdec($htmlCode[2].$htmlCode[3]); |
|
| 45 | + $b = hexdec($htmlCode[4].$htmlCode[5]); |
|
| 46 | 46 | |
| 47 | 47 | return ['r' => $r, 'g' => $g, 'b' => $b]; |
| 48 | 48 | } |
@@ -56,9 +56,9 @@ discard block |
||
| 56 | 56 | */ |
| 57 | 57 | public static function RGBToHSL(array $rgb): array |
| 58 | 58 | { |
| 59 | - $r = ((float)$rgb['r']) / 255.0; |
|
| 60 | - $g = ((float)$rgb['g']) / 255.0; |
|
| 61 | - $b = ((float)$rgb['b']) / 255.0; |
|
| 59 | + $r = ((float) $rgb['r']) / 255.0; |
|
| 60 | + $g = ((float) $rgb['g']) / 255.0; |
|
| 61 | + $b = ((float) $rgb['b']) / 255.0; |
|
| 62 | 62 | |
| 63 | 63 | $maxC = max($r, $g, $b); |
| 64 | 64 | $minC = min($r, $g, $b); |
@@ -86,9 +86,9 @@ discard block |
||
| 86 | 86 | $h /= 6.0; |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - $h = (int)round(360.0 * $h); |
|
| 90 | - $s = (int)round(100.0 * $s); |
|
| 91 | - $l = (int)round(100.0 * $l); |
|
| 89 | + $h = (int) round(360.0 * $h); |
|
| 90 | + $s = (int) round(100.0 * $s); |
|
| 91 | + $l = (int) round(100.0 * $l); |
|
| 92 | 92 | |
| 93 | 93 | return ['h' => $h, 's' => $s, 'l' => $l]; |
| 94 | 94 | } |