| @@ -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 | 
| @@ -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; | 
| @@ -83,7 +83,7 @@ discard block | ||
| 83 | 83 |          Craft::beginProfile('generatePlaceholderImage', __METHOD__); | 
| 84 | 84 | $result = ''; | 
| 85 | 85 | $width = self::PLACEHOLDER_WIDTH; | 
| 86 | - $height = (int)($width / $aspectRatio); | |
| 86 | + $height = (int) ($width / $aspectRatio); | |
| 87 | 87 | $placeholderPath = $this->createImageFromPath($tempPath, $width, $height, self::PLACEHOLDER_QUALITY, $position); | 
| 88 | 88 |          if (!empty($placeholderPath)) { | 
| 89 | 89 | $result = base64_encode(file_get_contents($placeholderPath)); | 
| @@ -175,7 +175,7 @@ discard block | ||
| 175 | 175 |      { | 
| 176 | 176 |          Craft::beginProfile('createTempPlaceholderImage', __METHOD__); | 
| 177 | 177 | $width = self::TEMP_PLACEHOLDER_WIDTH; | 
| 178 | - $height = (int)($width / $aspectRatio); | |
| 178 | + $height = (int) ($width / $aspectRatio); | |
| 179 | 179 | $tempPath = $this->createImageFromAsset($asset, $width, $height, self::TEMP_PLACEHOLDER_QUALITY, $position); | 
| 180 | 180 |          Craft::endProfile('createTempPlaceholderImage', __METHOD__); | 
| 181 | 181 | |
| @@ -200,7 +200,7 @@ discard block | ||
| 200 | 200 | Event::on( | 
| 201 | 201 | CraftVariable::class, | 
| 202 | 202 | CraftVariable::EVENT_INIT, | 
| 203 | -            function (Event $event) { | |
| 203 | +            function(Event $event) { | |
| 204 | 204 | /** @var CraftVariable $variable */ | 
| 205 | 205 | $variable = $event->sender; | 
| 206 | 206 |                  $variable->set('imageOptimize', ImageOptimizeVariable::class); | 
| @@ -211,7 +211,7 @@ discard block | ||
| 211 | 211 | Event::on( | 
| 212 | 212 | Fields::class, | 
| 213 | 213 | Fields::EVENT_REGISTER_FIELD_TYPES, | 
| 214 | -            function (RegisterComponentTypesEvent $event) { | |
| 214 | +            function(RegisterComponentTypesEvent $event) { | |
| 215 | 215 | Craft::debug( | 
| 216 | 216 | 'Fields::EVENT_REGISTER_FIELD_TYPES', | 
| 217 | 217 | __METHOD__ | 
| @@ -246,7 +246,7 @@ discard block | ||
| 246 | 246 | Event::on( | 
| 247 | 247 | Assets::class, | 
| 248 | 248 | Assets::EVENT_GET_ASSET_URL, | 
| 249 | -            function (GetAssetUrlEvent $event) { | |
| 249 | +            function(GetAssetUrlEvent $event) { | |
| 250 | 250 | Craft::debug( | 
| 251 | 251 | 'Assets::EVENT_GET_ASSET_URL', | 
| 252 | 252 | __METHOD__ | 
| @@ -262,7 +262,7 @@ discard block | ||
| 262 | 262 | Event::on( | 
| 263 | 263 | AssetTransforms::class, | 
| 264 | 264 | AssetTransforms::EVENT_GENERATE_TRANSFORM, | 
| 265 | -            function (GenerateTransformEvent $event) { | |
| 265 | +            function(GenerateTransformEvent $event) { | |
| 266 | 266 | Craft::debug( | 
| 267 | 267 | 'AssetTransforms::EVENT_GENERATE_TRANSFORM', | 
| 268 | 268 | __METHOD__ | 
| @@ -278,7 +278,7 @@ discard block | ||
| 278 | 278 | Event::on( | 
| 279 | 279 | AssetTransforms::class, | 
| 280 | 280 | AssetTransforms::EVENT_AFTER_DELETE_TRANSFORMS, | 
| 281 | -            function (AssetTransformImageEvent $event) { | |
| 281 | +            function(AssetTransformImageEvent $event) { | |
| 282 | 282 | Craft::debug( | 
| 283 | 283 | 'AssetTransforms::EVENT_AFTER_DELETE_TRANSFORMS', | 
| 284 | 284 | __METHOD__ | 
| @@ -294,7 +294,7 @@ discard block | ||
| 294 | 294 | Event::on( | 
| 295 | 295 | Assets::class, | 
| 296 | 296 | Assets::EVENT_BEFORE_REPLACE_ASSET, | 
| 297 | -            function (ReplaceAssetEvent $event) { | |
| 297 | +            function(ReplaceAssetEvent $event) { | |
| 298 | 298 | Craft::debug( | 
| 299 | 299 | 'Assets::EVENT_BEFORE_REPLACE_ASSET', | 
| 300 | 300 | __METHOD__ | 
| @@ -316,7 +316,7 @@ discard block | ||
| 316 | 316 | Event::on( | 
| 317 | 317 | Assets::class, | 
| 318 | 318 | Assets::EVENT_AFTER_REPLACE_ASSET, | 
| 319 | -            function (ReplaceAssetEvent $event) { | |
| 319 | +            function(ReplaceAssetEvent $event) { | |
| 320 | 320 | Craft::debug( | 
| 321 | 321 | 'Assets::EVENT_AFTER_REPLACE_ASSET', | 
| 322 | 322 | __METHOD__ | 
| @@ -339,7 +339,7 @@ discard block | ||
| 339 | 339 | Event::on( | 
| 340 | 340 | Assets::class, | 
| 341 | 341 | Elements::EVENT_BEFORE_SAVE_ELEMENT, | 
| 342 | -            function (ElementEvent $event) { | |
| 342 | +            function(ElementEvent $event) { | |
| 343 | 343 | Craft::debug( | 
| 344 | 344 | 'Elements::EVENT_BEFORE_SAVE_ELEMENT', | 
| 345 | 345 | __METHOD__ | 
| @@ -363,7 +363,7 @@ discard block | ||
| 363 | 363 | Event::on( | 
| 364 | 364 | Asset::class, | 
| 365 | 365 | Elements::EVENT_BEFORE_DELETE_ELEMENT, | 
| 366 | -            function (ElementEvent $event) { | |
| 366 | +            function(ElementEvent $event) { | |
| 367 | 367 | Craft::debug( | 
| 368 | 368 | 'Elements::EVENT_BEFORE_DELETE_ELEMENT', | 
| 369 | 369 | __METHOD__ | 
| @@ -392,7 +392,7 @@ discard block | ||
| 392 | 392 | Event::on( | 
| 393 | 393 | Fields::class, | 
| 394 | 394 | Fields::EVENT_AFTER_SAVE_FIELD, | 
| 395 | -            function (FieldEvent $event) { | |
| 395 | +            function(FieldEvent $event) { | |
| 396 | 396 | Craft::debug( | 
| 397 | 397 | 'Fields::EVENT_AFTER_SAVE_FIELD', | 
| 398 | 398 | __METHOD__ | 
| @@ -409,7 +409,7 @@ discard block | ||
| 409 | 409 | Event::on( | 
| 410 | 410 | Plugins::class, | 
| 411 | 411 | Plugins::EVENT_AFTER_SAVE_PLUGIN_SETTINGS, | 
| 412 | -            function (PluginEvent $event) { | |
| 412 | +            function(PluginEvent $event) { | |
| 413 | 413 |                  if ($event->plugin === $this) { | 
| 414 | 414 | Craft::debug( | 
| 415 | 415 | 'Plugins::EVENT_AFTER_SAVE_PLUGIN_SETTINGS', | 
| @@ -428,7 +428,7 @@ discard block | ||
| 428 | 428 | Event::on( | 
| 429 | 429 | Volumes::class, | 
| 430 | 430 | Volumes::EVENT_AFTER_SAVE_VOLUME, | 
| 431 | -            function (VolumeEvent $event) { | |
| 431 | +            function(VolumeEvent $event) { | |
| 432 | 432 | Craft::debug( | 
| 433 | 433 | 'Volumes::EVENT_AFTER_SAVE_VOLUME', | 
| 434 | 434 | __METHOD__ | 
| @@ -449,7 +449,7 @@ discard block | ||
| 449 | 449 | Event::on( | 
| 450 | 450 | Plugins::class, | 
| 451 | 451 | Plugins::EVENT_AFTER_INSTALL_PLUGIN, | 
| 452 | -            function (PluginEvent $event) { | |
| 452 | +            function(PluginEvent $event) { | |
| 453 | 453 |                  if ($event->plugin === $this) { | 
| 454 | 454 | $request = Craft::$app->getRequest(); | 
| 455 | 455 |                      if ($request->isCpRequest) { | 
| @@ -483,7 +483,7 @@ discard block | ||
| 483 | 483 | Event::on( | 
| 484 | 484 | UrlManager::class, | 
| 485 | 485 | UrlManager::EVENT_REGISTER_SITE_URL_RULES, | 
| 486 | -            function (RegisterUrlRulesEvent $event) { | |
| 486 | +            function(RegisterUrlRulesEvent $event) { | |
| 487 | 487 | Craft::debug( | 
| 488 | 488 | 'UrlManager::EVENT_REGISTER_SITE_URL_RULES', | 
| 489 | 489 | __METHOD__ | 
| @@ -46,7 +46,7 @@ | ||
| 46 | 46 | self::$config['server']['manifestPath'] = Craft::getAlias($bundle->sourcePath); | 
| 47 | 47 |          $useDevServer = getenv('NYS_PLUGIN_DEVSERVER'); | 
| 48 | 48 |          if ($useDevServer !== false) { | 
| 49 | - self::$config['useDevServer'] = (bool)$useDevServer; | |
| 49 | + self::$config['useDevServer'] = (bool) $useDevServer; | |
| 50 | 50 | } | 
| 51 | 51 | } | 
| 52 | 52 | |
| @@ -403,7 +403,7 @@ discard block | ||
| 403 | 403 | $cache = Craft::$app->getCache(); | 
| 404 | 404 | $file = $cache->getOrSet( | 
| 405 | 405 | self::CACHE_KEY.$path, | 
| 406 | -            function () use ($path, $callback) { | |
| 406 | +            function() use ($path, $callback) { | |
| 407 | 407 | $result = null; | 
| 408 | 408 | $contents = @file_get_contents($path); | 
| 409 | 409 |                  if ($contents) { | 
| @@ -433,7 +433,7 @@ discard block | ||
| 433 | 433 | protected static function combinePaths(string ...$paths): string | 
| 434 | 434 |      { | 
| 435 | 435 | $last_key = \count($paths) - 1; | 
| 436 | -        array_walk($paths, function (&$val, $key) use ($last_key) { | |
| 436 | +        array_walk($paths, function(&$val, $key) use ($last_key) { | |
| 437 | 437 |              switch ($key) { | 
| 438 | 438 | case 0: | 
| 439 | 439 | $val = rtrim($val, '/ '); | 
| @@ -50,7 +50,7 @@ | ||
| 50 | 50 | * | 
| 51 | 51 | * @return string | 
| 52 | 52 | */ | 
| 53 | - public static function getWebPUrl(string $url, Asset $asset, $transform, array $params = []): string | |
| 53 | + public static function getWebPUrl(string $url, Asset $asset, $transform, array $params = []): string | |
| 54 | 54 |      { | 
| 55 | 55 | $builder = self::getUrlBuilderForTransform($asset, $transform, $params) | 
| 56 | 56 |              ->addFilter('format', 'webp'); |