Issues (22)

src/Requests/Traits/HasImageUploadTrait.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace WebDevEtc\BlogEtc\Requests\Traits;
4
5
use Illuminate\Http\UploadedFile;
6
7
trait HasImageUploadTrait
8
{
9
    /**
10
     * @param $size
11
     *
12
     * @return UploadedFile|null
13
     */
14
    public function get_image_file($size)
15
    {
16
        if ($this->file($size)) {
0 ignored issues
show
It seems like file() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

16
        if ($this->/** @scrutinizer ignore-call */ file($size)) {
Loading history...
17
            return $this->file($size);
18
        }
19
20
        // not found? lets cycle through all the images and see if anything was submitted, and use that instead
21
        foreach (config('blogetc.image_sizes') as $image_size_name => $image_size_info) {
22
            if ($this->file($image_size_name)) {
23
                return $this->file($image_size_name);
24
            }
25
        }
26
    }
27
}
28