Completed
Pull Request — master (#15)
by Yaro
08:09 queued 01:44
created

Storage::getUrl()   B

Complexity

Conditions 7
Paths 7

Size

Total Lines 23

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 56

Importance

Changes 0
Metric Value
dl 0
loc 23
ccs 0
cts 13
cp 0
rs 8.6186
c 0
b 0
f 0
cc 7
nc 7
nop 1
crap 56
1
<?php
2
3
namespace Yaro\Jarboe\Table\Fields\Traits;
4
5
use Illuminate\Http\Request;
6
use Illuminate\Http\UploadedFile;
7
8
trait Storage
9
{
10
    protected $disk;
11
    protected $path = '';
12
    protected $multiple = false;
13
14
    protected function storeFile(UploadedFile $file, $filename, Request $request)
15
    {
16
        $path = $file->storeAs($this->getPath(), $filename, [
17
            'disk' => $this->getDisk(),
18
        ]);
19
20
        return $path;
21
    }
22
23
    public function multiple(bool $multiple = true)
24
    {
25
        $this->multiple = $multiple;
26
27
        return $this;
28
    }
29
30
    public function isMultiple()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
31 2
    {
32
        return $this->multiple;
33 2
    }
34
35
    public function disk(string $disk)
36 1
    {
37
        $this->disk = $disk;
38 1
39
        return $this;
40 1
    }
41
42
    public function getDisk()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
43 1
    {
44
        return $this->disk;
45 1
    }
46
47
    public function path(string $path)
48 1
    {
49
        $this->path = $path;
50 1
51
        return $this;
52 1
    }
53
54
    public function getPath()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
55 1
    {
56
        return $this->path;
57 1
    }
58
}
59