@@ -15,7 +15,7 @@ |
||
15 | 15 | /> |
16 | 16 | </svg> |
17 | 17 | ", 200, [ |
18 | - 'Content-Type' => 'image/svg+xml', |
|
19 | - ]); |
|
18 | + 'Content-Type' => 'image/svg+xml', |
|
19 | + ]); |
|
20 | 20 | } |
21 | 21 | } |
@@ -41,10 +41,10 @@ |
||
41 | 41 | |
42 | 42 | public function image() |
43 | 43 | { |
44 | - $colorBlockImage = match ($this->extension) { |
|
45 | - 'png' => ( new ColorBlockPng($this->with, $this->height, $this->color) ), |
|
46 | - 'jpg', 'jpeg' => ( new ColorBlockJpg($this->with, $this->height, $this->color) ), |
|
47 | - default => ( new ColorBlockSvg($this->with, $this->height, $this->color) ), |
|
44 | + $colorBlockImage = match($this->extension) { |
|
45 | + 'png' => (new ColorBlockPng($this->with, $this->height, $this->color)), |
|
46 | + 'jpg', 'jpeg' => (new ColorBlockJpg($this->with, $this->height, $this->color)), |
|
47 | + default => (new ColorBlockSvg($this->with, $this->height, $this->color)), |
|
48 | 48 | }; |
49 | 49 | |
50 | 50 | return $colorBlockImage->image(); |
@@ -58,14 +58,14 @@ |
||
58 | 58 | $namePrefix = $namePrefix ?? $this->app['config']['lorem-image.route.name_prefix']; |
59 | 59 | |
60 | 60 | Route::prefix($prefix) |
61 | - ->as("{$namePrefix}.") |
|
62 | - ->where([ |
|
63 | - 'extension' => '(' . implode('|', config('lorem-image.drivers.color-block.extensions')) . ')', |
|
64 | - ]) |
|
65 | - ->group(function () { |
|
66 | - Route::get('color-block.{extension}', ColorBlockController::class) |
|
67 | - ->name('color-block'); |
|
68 | - }); |
|
61 | + ->as("{$namePrefix}.") |
|
62 | + ->where([ |
|
63 | + 'extension' => '(' . implode('|', config('lorem-image.drivers.color-block.extensions')) . ')', |
|
64 | + ]) |
|
65 | + ->group(function () { |
|
66 | + Route::get('color-block.{extension}', ColorBlockController::class) |
|
67 | + ->name('color-block'); |
|
68 | + }); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | */ |
55 | 55 | public function routes(?string $prefix = null, ?string $namePrefix = null): void |
56 | 56 | { |
57 | - $prefix = $prefix ?? $this->app['config']['lorem-image.route.prefix']; |
|
57 | + $prefix = $prefix ?? $this->app['config']['lorem-image.route.prefix']; |
|
58 | 58 | $namePrefix = $namePrefix ?? $this->app['config']['lorem-image.route.name_prefix']; |
59 | 59 | |
60 | 60 | Route::prefix($prefix) |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | ->where([ |
63 | 63 | 'extension' => '(' . implode('|', config('lorem-image.drivers.color-block.extensions')) . ')', |
64 | 64 | ]) |
65 | - ->group(function () { |
|
65 | + ->group(function() { |
|
66 | 66 | Route::get('color-block.{extension}', ColorBlockController::class) |
67 | 67 | ->name('color-block'); |
68 | 68 | }); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | { |
80 | 80 | $name = $name ?: $this->getDefaultDriver(); |
81 | 81 | |
82 | - return $this->drivers[ $name ] = $this->get($name); |
|
82 | + return $this->drivers[$name] = $this->get($name); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -95,8 +95,8 @@ discard block |
||
95 | 95 | { |
96 | 96 | $config = $this->getConfig($name) ?? []; |
97 | 97 | |
98 | - if (isset($this->customCreators[ $name ])) { |
|
99 | - return $this->customCreators[ $name ]($config); |
|
98 | + if (isset($this->customCreators[$name])) { |
|
99 | + return $this->customCreators[$name]($config); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | $driverMethod = 'create' . ucfirst(Str::camel($name)) . 'Driver'; |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | */ |
139 | 139 | public function extend(string $driver, Closure $callback): static |
140 | 140 | { |
141 | - $this->customCreators[ $driver ] = $callback; |
|
141 | + $this->customCreators[$driver] = $callback; |
|
142 | 142 | |
143 | 143 | return $this; |
144 | 144 | } |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | */ |
193 | 193 | protected function get(string $name): LimsumUrlMaker |
194 | 194 | { |
195 | - return $this->drivers[ $name ] ?? $this->resolve($name); |
|
195 | + return $this->drivers[$name] ?? $this->resolve($name); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | /** |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | { |
207 | 207 | $name = $name ?? $this->getDefaultDriver(); |
208 | 208 | |
209 | - unset($this->drivers[ $name ]); |
|
209 | + unset($this->drivers[$name]); |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | /** |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | $url = "{$url}/seed/{$seed}"; |
152 | 152 | } |
153 | 153 | |
154 | - $width = $params['width'] ?? $this->width; |
|
154 | + $width = $params['width'] ?? $this->width; |
|
155 | 155 | $height = $params['height'] ?? $this->height; |
156 | 156 | $url = "{$url}/{$width}/{$height}"; |
157 | 157 | |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | */ |
264 | 264 | public function type(string $type): static |
265 | 265 | { |
266 | - if (!isset($this->types[ $type ]) || !is_array($data = $this->types[ $type ])) { |
|
266 | + if (!isset($this->types[$type]) || !is_array($data = $this->types[$type])) { |
|
267 | 267 | throw new \InvalidArgumentException("Type [{$type}] not supported."); |
268 | 268 | } |
269 | 269 | |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | ] as $key |
281 | 281 | ) { |
282 | 282 | if (array_key_exists($key, $data)) { |
283 | - $this->$key = $data[ $key ]; |
|
283 | + $this->$key = $data[$key]; |
|
284 | 284 | } |
285 | 285 | } |
286 | 286 |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function __construct(array $config) |
45 | 45 | { |
46 | - $this->config = $config; |
|
46 | + $this->config = $config; |
|
47 | 47 | $this->reset(); |
48 | 48 | } |
49 | 49 | |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | */ |
160 | 160 | public function type(string $type): static |
161 | 161 | { |
162 | - if (!isset($this->types[ $type ]) || !is_array($data = $this->types[ $type ])) { |
|
162 | + if (!isset($this->types[$type]) || !is_array($data = $this->types[$type])) { |
|
163 | 163 | throw new \InvalidArgumentException("Type [{$type}] not supported."); |
164 | 164 | } |
165 | 165 | |
@@ -171,8 +171,8 @@ discard block |
||
171 | 171 | 'extension', |
172 | 172 | ] as $key |
173 | 173 | ) { |
174 | - if (isset($data[ $key ])) { |
|
175 | - $this->$key = $data[ $key ]; |
|
174 | + if (isset($data[$key])) { |
|
175 | + $this->$key = $data[$key]; |
|
176 | 176 | } |
177 | 177 | } |
178 | 178 |
@@ -17,7 +17,7 @@ |
||
17 | 17 | ]); |
18 | 18 | } |
19 | 19 | |
20 | - $this->app->bind('limsum', function ($app) { |
|
20 | + $this->app->bind('limsum', function($app) { |
|
21 | 21 | return new LipsumManager($app); |
22 | 22 | }); |
23 | 23 | } |