Completed
Pull Request — master (#14)
by
unknown
15:13 queued 07: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 2
    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
    {
32 2
        return $this->multiple;
33
    }
34
35 1
    public function disk(string $disk)
36
    {
37 1
        $this->disk = $disk;
38
39 1
        return $this;
40
    }
41
42 1
    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
    {
44 1
        return $this->disk;
45
    }
46
47 1
    public function path(string $path)
48
    {
49 1
        $this->path = $path;
50
51 1
        return $this;
52
    }
53
54 1
    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
    {
56 1
        return $this->path;
57
    }
58
}
59