@@ -53,8 +53,8 @@ |
||
| 53 | 53 | // It takes a bit of time, so if you never plan to use it, you can turn it off |
| 54 | 54 | 'createColorPalette' => true, |
| 55 | 55 | |
| 56 | - // Controls whether SVG placeholder silhouettes should be created for image variants |
|
| 57 | - // It takes a bit of time, so if you never plan to use them, you can turn it off |
|
| 56 | + // Controls whether SVG placeholder silhouettes should be created for image variants |
|
| 57 | + // It takes a bit of time, so if you never plan to use them, you can turn it off |
|
| 58 | 58 | 'createPlaceholderSilhouettes' => true, |
| 59 | 59 | |
| 60 | 60 | // Controls whether retina images are automatically created with reduced quality |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | Event::on( |
| 199 | 199 | CraftVariable::class, |
| 200 | 200 | CraftVariable::EVENT_INIT, |
| 201 | - function (Event $event) { |
|
| 201 | + function(Event $event) { |
|
| 202 | 202 | /** @var CraftVariable $variable */ |
| 203 | 203 | $variable = $event->sender; |
| 204 | 204 | $variable->set('imageOptimize', ImageOptimizeVariable::class); |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | Event::on( |
| 210 | 210 | Fields::class, |
| 211 | 211 | Fields::EVENT_REGISTER_FIELD_TYPES, |
| 212 | - function (RegisterComponentTypesEvent $event) { |
|
| 212 | + function(RegisterComponentTypesEvent $event) { |
|
| 213 | 213 | Craft::debug( |
| 214 | 214 | 'Fields::EVENT_REGISTER_FIELD_TYPES', |
| 215 | 215 | __METHOD__ |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | Event::on( |
| 240 | 240 | Assets::class, |
| 241 | 241 | Assets::EVENT_GET_ASSET_URL, |
| 242 | - function (GetAssetUrlEvent $event) { |
|
| 242 | + function(GetAssetUrlEvent $event) { |
|
| 243 | 243 | Craft::debug( |
| 244 | 244 | 'Assets::EVENT_GET_ASSET_URL', |
| 245 | 245 | __METHOD__ |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | Event::on( |
| 256 | 256 | AssetTransforms::class, |
| 257 | 257 | AssetTransforms::EVENT_GENERATE_TRANSFORM, |
| 258 | - function (GenerateTransformEvent $event) { |
|
| 258 | + function(GenerateTransformEvent $event) { |
|
| 259 | 259 | Craft::debug( |
| 260 | 260 | 'AssetTransforms::EVENT_GENERATE_TRANSFORM', |
| 261 | 261 | __METHOD__ |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | Event::on( |
| 272 | 272 | AssetTransforms::class, |
| 273 | 273 | AssetTransforms::EVENT_AFTER_DELETE_TRANSFORMS, |
| 274 | - function (AssetTransformImageEvent $event) { |
|
| 274 | + function(AssetTransformImageEvent $event) { |
|
| 275 | 275 | Craft::debug( |
| 276 | 276 | 'AssetTransforms::EVENT_AFTER_DELETE_TRANSFORMS', |
| 277 | 277 | __METHOD__ |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | Event::on( |
| 288 | 288 | Assets::class, |
| 289 | 289 | Assets::EVENT_BEFORE_REPLACE_ASSET, |
| 290 | - function (ReplaceAssetEvent $event) { |
|
| 290 | + function(ReplaceAssetEvent $event) { |
|
| 291 | 291 | Craft::debug( |
| 292 | 292 | 'Assets::EVENT_BEFORE_REPLACE_ASSET', |
| 293 | 293 | __METHOD__ |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | Event::on( |
| 310 | 310 | Assets::class, |
| 311 | 311 | Assets::EVENT_AFTER_REPLACE_ASSET, |
| 312 | - function (ReplaceAssetEvent $event) { |
|
| 312 | + function(ReplaceAssetEvent $event) { |
|
| 313 | 313 | Craft::debug( |
| 314 | 314 | 'Assets::EVENT_AFTER_REPLACE_ASSET', |
| 315 | 315 | __METHOD__ |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | Event::on( |
| 333 | 333 | Assets::class, |
| 334 | 334 | Elements::EVENT_BEFORE_SAVE_ELEMENT, |
| 335 | - function (ElementEvent $event) { |
|
| 335 | + function(ElementEvent $event) { |
|
| 336 | 336 | Craft::debug( |
| 337 | 337 | 'Elements::EVENT_BEFORE_SAVE_ELEMENT', |
| 338 | 338 | __METHOD__ |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | Event::on( |
| 357 | 357 | Asset::class, |
| 358 | 358 | Elements::EVENT_BEFORE_DELETE_ELEMENT, |
| 359 | - function (ElementEvent $event) { |
|
| 359 | + function(ElementEvent $event) { |
|
| 360 | 360 | Craft::debug( |
| 361 | 361 | 'Elements::EVENT_BEFORE_DELETE_ELEMENT', |
| 362 | 362 | __METHOD__ |
@@ -385,7 +385,7 @@ discard block |
||
| 385 | 385 | Event::on( |
| 386 | 386 | Fields::class, |
| 387 | 387 | Fields::EVENT_AFTER_SAVE_FIELD, |
| 388 | - function (FieldEvent $event) { |
|
| 388 | + function(FieldEvent $event) { |
|
| 389 | 389 | Craft::debug( |
| 390 | 390 | 'Fields::EVENT_AFTER_SAVE_FIELD', |
| 391 | 391 | __METHOD__ |
@@ -402,7 +402,7 @@ discard block |
||
| 402 | 402 | Event::on( |
| 403 | 403 | Plugins::class, |
| 404 | 404 | Plugins::EVENT_AFTER_SAVE_PLUGIN_SETTINGS, |
| 405 | - function (PluginEvent $event) { |
|
| 405 | + function(PluginEvent $event) { |
|
| 406 | 406 | if ($event->plugin === $this) { |
| 407 | 407 | Craft::debug( |
| 408 | 408 | 'Plugins::EVENT_AFTER_SAVE_PLUGIN_SETTINGS', |
@@ -421,7 +421,7 @@ discard block |
||
| 421 | 421 | Event::on( |
| 422 | 422 | Volumes::class, |
| 423 | 423 | Volumes::EVENT_AFTER_SAVE_VOLUME, |
| 424 | - function (VolumeEvent $event) { |
|
| 424 | + function(VolumeEvent $event) { |
|
| 425 | 425 | Craft::debug( |
| 426 | 426 | 'Volumes::EVENT_AFTER_SAVE_VOLUME', |
| 427 | 427 | __METHOD__ |
@@ -442,7 +442,7 @@ discard block |
||
| 442 | 442 | Event::on( |
| 443 | 443 | Plugins::class, |
| 444 | 444 | Plugins::EVENT_AFTER_INSTALL_PLUGIN, |
| 445 | - function (PluginEvent $event) { |
|
| 445 | + function(PluginEvent $event) { |
|
| 446 | 446 | if ($event->plugin === $this) { |
| 447 | 447 | $request = Craft::$app->getRequest(); |
| 448 | 448 | if ($request->isCpRequest) { |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | */ |
| 368 | 368 | public function getPlaceholderImage(): string |
| 369 | 369 | { |
| 370 | - return (string)$this->placeholderImage(); |
|
| 370 | + return (string) $this->placeholderImage(); |
|
| 371 | 371 | } |
| 372 | 372 | |
| 373 | 373 | /** |
@@ -404,7 +404,7 @@ discard block |
||
| 404 | 404 | */ |
| 405 | 405 | public function getPlaceholderBox(string $color = null): string |
| 406 | 406 | { |
| 407 | - return (string)$this->placeholderBox($color); |
|
| 407 | + return (string) $this->placeholderBox($color); |
|
| 408 | 408 | } |
| 409 | 409 | |
| 410 | 410 | /** |
@@ -445,7 +445,7 @@ discard block |
||
| 445 | 445 | */ |
| 446 | 446 | public function getPlaceholderSilhouette(): string |
| 447 | 447 | { |
| 448 | - return (string)$this->placeholderSilhouette(); |
|
| 448 | + return (string) $this->placeholderSilhouette(); |
|
| 449 | 449 | } |
| 450 | 450 | |
| 451 | 451 | /** |
@@ -557,10 +557,10 @@ discard block |
||
| 557 | 557 | foreach ($array as $key => $value) { |
| 558 | 558 | if ($dpr) { |
| 559 | 559 | $descriptor = '1x'; |
| 560 | - if (!empty($array[(int)$key / 2])) { |
|
| 560 | + if (!empty($array[(int) $key / 2])) { |
|
| 561 | 561 | $descriptor = '2x'; |
| 562 | 562 | } |
| 563 | - if (!empty($array[(int)$key / 3])) { |
|
| 563 | + if (!empty($array[(int) $key / 3])) { |
|
| 564 | 564 | $descriptor = '3x'; |
| 565 | 565 | } |
| 566 | 566 | } else { |
@@ -39,16 +39,16 @@ |
||
| 39 | 39 | |
| 40 | 40 | // Primary getter functions |
| 41 | 41 | $fieldObject->addStringField('src') |
| 42 | - ->arguments(function (\markhuot\CraftQL\Builders\Field $field) { |
|
| 42 | + ->arguments(function(\markhuot\CraftQL\Builders\Field $field) { |
|
| 43 | 43 | $field->addIntArgument('width'); |
| 44 | 44 | }) |
| 45 | - ->resolve(function ($root, $args) { |
|
| 45 | + ->resolve(function($root, $args) { |
|
| 46 | 46 | return $root->src(@$args['width'] ?: 0); |
| 47 | 47 | }); |
| 48 | 48 | $fieldObject->addField('srcUrls') |
| 49 | 49 | ->lists() |
| 50 | 50 | ->type($srcObject) |
| 51 | - ->resolve(function ($root, $args) { |
|
| 51 | + ->resolve(function($root, $args) { |
|
| 52 | 52 | $result = []; |
| 53 | 53 | foreach ($root->optimizedImageUrls as $width => $url) { |
| 54 | 54 | $result[] = ['width' => $width, 'url' => $url]; |
@@ -130,12 +130,12 @@ discard block |
||
| 130 | 130 | { |
| 131 | 131 | $path = self::decomposeUrl($pathOrUrl); |
| 132 | 132 | $path_parts = pathinfo($path['path']); |
| 133 | - $new_path = $path_parts['filename'] . '.' . $path_parts['extension'] . $extension; |
|
| 133 | + $new_path = $path_parts['filename'].'.'.$path_parts['extension'].$extension; |
|
| 134 | 134 | if (!empty($path_parts['dirname']) && $path_parts['dirname'] !== '.') { |
| 135 | - $new_path = $path_parts['dirname'] . DIRECTORY_SEPARATOR . $new_path; |
|
| 135 | + $new_path = $path_parts['dirname'].DIRECTORY_SEPARATOR.$new_path; |
|
| 136 | 136 | $new_path = preg_replace('/([^:])(\/{2,})/', '$1/', $new_path); |
| 137 | 137 | } |
| 138 | - $output = $path['prefix'] . $new_path . $path['suffix']; |
|
| 138 | + $output = $path['prefix'].$new_path.$path['suffix']; |
|
| 139 | 139 | |
| 140 | 140 | return $output; |
| 141 | 141 | } |
@@ -156,11 +156,11 @@ discard block |
||
| 156 | 156 | |
| 157 | 157 | if (filter_var($pathOrUrl, FILTER_VALIDATE_URL)) { |
| 158 | 158 | $url_parts = parse_url($pathOrUrl); |
| 159 | - $result['prefix'] = $url_parts['scheme'] . '://' . $url_parts['host']; |
|
| 159 | + $result['prefix'] = $url_parts['scheme'].'://'.$url_parts['host']; |
|
| 160 | 160 | $result['path'] = $url_parts['path']; |
| 161 | 161 | $result['suffix'] = ''; |
| 162 | - $result['suffix'] .= empty($url_parts['query']) ? '' : '?' . $url_parts['query']; |
|
| 163 | - $result['suffix'] .= empty($url_parts['fragment']) ? '' : '#' . $url_parts['fragment']; |
|
| 162 | + $result['suffix'] .= empty($url_parts['query']) ? '' : '?'.$url_parts['query']; |
|
| 163 | + $result['suffix'] .= empty($url_parts['fragment']) ? '' : '#'.$url_parts['fragment']; |
|
| 164 | 164 | } else { |
| 165 | 165 | $result['prefix'] = ''; |
| 166 | 166 | $result['path'] = $pathOrUrl; |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | if (Image::canManipulateAsImage($finalFormat) |
| 120 | 120 | && Image::canManipulateAsImage($finalFormat) |
| 121 | 121 | && $asset->height > 0) { |
| 122 | - $variant = [ |
|
| 122 | + $variant = [ |
|
| 123 | 123 | 'width' => $asset->width, |
| 124 | 124 | 'useAspectRatio' => false, |
| 125 | 125 | 'aspectRatioX' => $asset->width, |
@@ -201,11 +201,11 @@ discard block |
||
| 201 | 201 | } |
| 202 | 202 | $width = $variant['width'] * $retinaSize; |
| 203 | 203 | $transform->width = $width; |
| 204 | - $transform->height = (int)($width / $aspectRatio); |
|
| 204 | + $transform->height = (int) ($width / $aspectRatio); |
|
| 205 | 205 | // Image quality |
| 206 | 206 | $quality = $variant['quality']; |
| 207 | 207 | if ($settings->lowerQualityRetinaImageVariants && $retinaSize != '1') { |
| 208 | - $quality = (int)($quality * (1.5 / (int)$retinaSize)); |
|
| 208 | + $quality = (int) ($quality * (1.5 / (int) $retinaSize)); |
|
| 209 | 209 | } |
| 210 | 210 | $transform->quality = $quality; |
| 211 | 211 | // Interlaced (progressive JPEGs or interlaced PNGs) |