Skip to content

Commit

Permalink
Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
ralphjsmit authored and github-actions[bot] committed Oct 27, 2023
1 parent 38f5727 commit 1f27526
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/Commands/ClearCacheCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ public function handle(): int
glide()->getCachePath()
);

$this->info("Cleared Glide cache");
$this->info('Cleared Glide cache');

return static::SUCCESS;
}
}
}
12 changes: 6 additions & 6 deletions src/GlideImageGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ public function src(string $path, int $maxWidth = null, string $sizes = null): C
return $attributes;
}

protected function getSrcAttribute(string $path, int | null $maxWidth): string
protected function getSrcAttribute(string $path, ?int $maxWidth): string
{
if ( $maxWidth === null ) {
if ($maxWidth === null) {
return asset($path);
}

Expand All @@ -37,7 +37,7 @@ protected function getSrcAttribute(string $path, int | null $maxWidth): string
]);
}

protected function getSrcsetAttribute(string $path, int | null $maxWidth): string
protected function getSrcsetAttribute(string $path, ?int $maxWidth): string
{
$scale = collect([
400,
Expand All @@ -62,11 +62,11 @@ protected function getSrcsetAttribute(string $path, int | null $maxWidth): strin
$scale = $scale
->when($maxWidth)->reject(fn (int $width) => $width > $maxWidth)
// We will up-scale an image up to 2x it's original size. Above that it has no use anymore.
->when($imageWidth)->reject(fn (int $width) => $width > ( $imageWidth * 2 ));
->when($imageWidth)->reject(fn (int $width) => $width > ($imageWidth * 2));

// Push a final version with exactly the correct max-width if the difference with the last item
// in the scale is bigger than 50px. Otherwise, the additional provided type is not so useful.
if ( $maxWidth && ( $maxWidth - $scale->last() ) > 50 ) {
if ($maxWidth && ($maxWidth - $scale->last()) > 50) {
$scale->push($maxWidth);
}

Expand Down Expand Up @@ -99,4 +99,4 @@ public function getCachePath(): string
{
return storage_path('framework/cache/glide');
}
}
}
2 changes: 1 addition & 1 deletion src/Http/Controllers/GlideController.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ public function __invoke(Request $request, Application $application, Filesystem
abort(404);
}
}
}
}
4 changes: 2 additions & 2 deletions src/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

use RalphJSmit\Laravel\Glide\GlideImageGenerator;

if ( ! function_exists('glide') ) {
if (! function_exists('glide')) {
function glide(): GlideImageGenerator
{
return app(GlideImageGenerator::class);
}
}
}

0 comments on commit 1f27526

Please sign in to comment.