@@ -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]; |
@@ -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, '/ '); |
@@ -51,7 +51,7 @@ |
||
51 | 51 | self::$config['server']['publicPath'] = $baseAssetsUrl; |
52 | 52 | $useDevServer = getenv('NYS_PLUGIN_DEVSERVER'); |
53 | 53 | if ($useDevServer !== false) { |
54 | - self::$config['useDevServer'] = (bool)$useDevServer; |
|
54 | + self::$config['useDevServer'] = (bool) $useDevServer; |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 |
@@ -58,9 +58,9 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public static function RGBToHSL(array $rgb): array |
60 | 60 | { |
61 | - $r = ((float)$rgb['r']) / 255.0; |
|
62 | - $g = ((float)$rgb['g']) / 255.0; |
|
63 | - $b = ((float)$rgb['b']) / 255.0; |
|
61 | + $r = ((float) $rgb['r']) / 255.0; |
|
62 | + $g = ((float) $rgb['g']) / 255.0; |
|
63 | + $b = ((float) $rgb['b']) / 255.0; |
|
64 | 64 | |
65 | 65 | $maxC = max($r, $g, $b); |
66 | 66 | $minC = min($r, $g, $b); |
@@ -88,9 +88,9 @@ discard block |
||
88 | 88 | $h /= 6.0; |
89 | 89 | } |
90 | 90 | |
91 | - $h = (int)round(360.0 * $h); |
|
92 | - $s = (int)round(100.0 * $s); |
|
93 | - $l = (int)round(100.0 * $l); |
|
91 | + $h = (int) round(360.0 * $h); |
|
92 | + $s = (int) round(100.0 * $s); |
|
93 | + $l = (int) round(100.0 * $l); |
|
94 | 94 | |
95 | 95 | return ['h' => $h, 's' => $s, 'l' => $l]; |
96 | 96 | } |
@@ -188,12 +188,12 @@ |
||
188 | 188 | ?: GqlEntityRegistry::createEntity($typeName, new OptimizedImagesType([ |
189 | 189 | 'name' => $typeName, |
190 | 190 | 'description' => 'This entity has all the OptimizedImages properties', |
191 | - 'fields' => function () use ($optimizedImagesFields) { |
|
191 | + 'fields' => function() use ($optimizedImagesFields) { |
|
192 | 192 | return $optimizedImagesFields; |
193 | 193 | }, |
194 | 194 | ])); |
195 | 195 | |
196 | - TypeLoader::registerType($typeName, function () use ($optimizedImagesType) { |
|
196 | + TypeLoader::registerType($typeName, function() use ($optimizedImagesType) { |
|
197 | 197 | return $optimizedImagesType; |
198 | 198 | }); |
199 | 199 |
@@ -51,8 +51,8 @@ |
||
51 | 51 | // It takes a bit of time, so if you never plan to use it, you can turn it off |
52 | 52 | 'createColorPalette' => true, |
53 | 53 | |
54 | - // Controls whether SVG placeholder silhouettes should be created for image variants |
|
55 | - // It takes a bit of time, so if you never plan to use them, you can turn it off |
|
54 | + // Controls whether SVG placeholder silhouettes should be created for image variants |
|
55 | + // It takes a bit of time, so if you never plan to use them, you can turn it off |
|
56 | 56 | 'createPlaceholderSilhouettes' => false, |
57 | 57 | |
58 | 58 | // Controls whether retina images are automatically created with reduced quality |
@@ -208,7 +208,7 @@ |
||
208 | 208 | if (ImageHelper::canManipulateAsImage($asset->getExtension())) { |
209 | 209 | $transform = new AssetTransform([ |
210 | 210 | 'width' => $event->width, |
211 | - 'height' => $event->height, |
|
211 | + 'height' => $event->height, |
|
212 | 212 | 'interlace' => 'line', |
213 | 213 | ]); |
214 | 214 | /** @var ImageTransform $transformMethod */ |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | $vars, |
280 | 280 | $minifier |
281 | 281 | ); |
282 | - $content = (string)$content; |
|
282 | + $content = (string) $content; |
|
283 | 283 | if ($scriptAttrs !== null) { |
284 | 284 | $attrs = array_merge([ |
285 | 285 | ], |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | $vars, |
315 | 315 | $minifier |
316 | 316 | ); |
317 | - $content = (string)$content; |
|
317 | + $content = (string) $content; |
|
318 | 318 | if ($scriptAttrs !== null) { |
319 | 319 | $attrs = array_merge([ |
320 | 320 | ], |
@@ -148,14 +148,14 @@ discard block |
||
148 | 148 | { |
149 | 149 | $path = $this->decomposeUrl($pathOrUrl); |
150 | 150 | $path_parts = pathinfo($path['path']); |
151 | - $new_path = ($path_parts['filename'] ?? '') . '.' . ($path_parts['extension'] ?? '') . $extension; |
|
151 | + $new_path = ($path_parts['filename'] ?? '').'.'.($path_parts['extension'] ?? '').$extension; |
|
152 | 152 | if (!empty($path_parts['dirname']) && $path_parts['dirname'] !== '.') { |
153 | 153 | $dirname = $path_parts['dirname']; |
154 | 154 | $dirname = $dirname === '/' ? '' : $dirname; |
155 | - $new_path = $dirname . DIRECTORY_SEPARATOR . $new_path; |
|
155 | + $new_path = $dirname.DIRECTORY_SEPARATOR.$new_path; |
|
156 | 156 | $new_path = preg_replace('/([^:])(\/{2,})/', '$1/', $new_path); |
157 | 157 | } |
158 | - $output = $path['prefix'] . $new_path . $path['suffix']; |
|
158 | + $output = $path['prefix'].$new_path.$path['suffix']; |
|
159 | 159 | |
160 | 160 | return $output; |
161 | 161 | } |
@@ -176,14 +176,14 @@ discard block |
||
176 | 176 | |
177 | 177 | if (filter_var($pathOrUrl, FILTER_VALIDATE_URL)) { |
178 | 178 | $url_parts = parse_url($pathOrUrl); |
179 | - $result['prefix'] = $url_parts['scheme'] . '://' . $url_parts['host']; |
|
179 | + $result['prefix'] = $url_parts['scheme'].'://'.$url_parts['host']; |
|
180 | 180 | if (!empty($url_parts['port'])) { |
181 | - $result['prefix'] .= ':' . $url_parts['port']; |
|
181 | + $result['prefix'] .= ':'.$url_parts['port']; |
|
182 | 182 | } |
183 | 183 | $result['path'] = $url_parts['path']; |
184 | 184 | $result['suffix'] = ''; |
185 | - $result['suffix'] .= empty($url_parts['query']) ? '' : '?' . $url_parts['query']; |
|
186 | - $result['suffix'] .= empty($url_parts['fragment']) ? '' : '#' . $url_parts['fragment']; |
|
185 | + $result['suffix'] .= empty($url_parts['query']) ? '' : '?'.$url_parts['query']; |
|
186 | + $result['suffix'] .= empty($url_parts['fragment']) ? '' : '#'.$url_parts['fragment']; |
|
187 | 187 | } else { |
188 | 188 | $result['prefix'] = ''; |
189 | 189 | $result['path'] = $pathOrUrl; |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | ); |
89 | 89 | $result = ''; |
90 | 90 | $width = self::PLACEHOLDER_WIDTH; |
91 | - $height = (int)($width / $aspectRatio); |
|
91 | + $height = (int) ($width / $aspectRatio); |
|
92 | 92 | $placeholderPath = $this->createImageFromPath($tempPath, $width, $height, self::PLACEHOLDER_QUALITY, $position); |
93 | 93 | if (!empty($placeholderPath)) { |
94 | 94 | $result = base64_encode(file_get_contents($placeholderPath)); |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | { |
111 | 111 | Craft::beginProfile('generateColorPalette', __METHOD__); |
112 | 112 | Craft::info( |
113 | - 'Generating color palette for: ' . $tempPath, |
|
113 | + 'Generating color palette for: '.$tempPath, |
|
114 | 114 | __METHOD__ |
115 | 115 | ); |
116 | 116 | $colorPalette = []; |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | $lightness /= $colorCount; |
157 | 157 | } |
158 | 158 | |
159 | - return $lightness === null ? $lightness : (int)$lightness; |
|
159 | + return $lightness === null ? $lightness : (int) $lightness; |
|
160 | 160 | } |
161 | 161 | /** |
162 | 162 | * Generate an SVG image via Potrace |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | __METHOD__ |
220 | 220 | ); |
221 | 221 | $width = self::TEMP_PLACEHOLDER_WIDTH; |
222 | - $height = (int)($width / $aspectRatio); |
|
222 | + $height = (int) ($width / $aspectRatio); |
|
223 | 223 | $tempPath = $this->createImageFromAsset($asset, $width, $height, self::TEMP_PLACEHOLDER_QUALITY, $position); |
224 | 224 | Craft::endProfile('createTempPlaceholderImage', __METHOD__); |
225 | 225 |