Issues (339)

src/Image.php (1 issue)

1
<?php
2
3
namespace UniSharp\Uploadable;
4
5
use Illuminate\Support\Facades\URL;
6
7
class Image extends File
8
{
9
    protected $table = 'files';
10
11
    protected $appends = ['thumb'];
12
13
    public function getThumbAttribute(): array
14
    {
15 2
        return collect(['s', 'm', 'l'])->flip()->map(function ($_, $size) {
16 2
            return URL::to(preg_replace('/^(images\/)/', "\$1{$size}/", $this->attributes['path']));
0 ignored issues
show
Coding Style Best Practice introduced by
As per coding-style, please use concatenation or sprintf for the variable $size instead of interpolation.

It is generally a best practice as it is often more readable to use concatenation instead of interpolation for variables inside strings.

// Instead of
$x = "foo $bar $baz";

// Better use either
$x = "foo " . $bar . " " . $baz;
$x = sprintf("foo %s %s", $bar, $baz);
Loading history...
17 2
        })->toArray();
18
    }
19
}
20