Total Complexity | 5 |
Total Lines | 63 |
Duplicated Lines | 0 % |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
5 | trait InteractsWithStorage |
||
6 | { |
||
7 | /** |
||
8 | * The disk of where the file to analyze is stored. |
||
9 | * |
||
10 | * @var string |
||
11 | */ |
||
12 | protected string $disk; |
||
13 | |||
14 | /** |
||
15 | * The path to the source of the file to analyze. |
||
16 | * |
||
17 | * @var string|null |
||
18 | */ |
||
19 | protected ?string $source = null; |
||
20 | |||
21 | /** |
||
22 | * Set which S3 disk to use. |
||
23 | * |
||
24 | * @param string $disk |
||
25 | * @return $this |
||
26 | */ |
||
27 | public function disk(string $disk) |
||
28 | { |
||
29 | $this->disk = $disk; |
||
30 | |||
31 | return $this; |
||
32 | } |
||
33 | |||
34 | /** |
||
35 | * The equivalent of the S3 Key / the path of the file inside the bucket. |
||
36 | * |
||
37 | * @param string $source |
||
38 | * @return $this |
||
39 | */ |
||
40 | public function source(string $source) |
||
41 | { |
||
42 | $this->source = $source; |
||
43 | |||
44 | return $this; |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * Alias of source(). |
||
49 | * |
||
50 | * @param string $source |
||
51 | * @return $this |
||
52 | */ |
||
53 | public function path(string $source) |
||
56 | } |
||
57 | |||
58 | /** |
||
59 | * Ensures the source/path not to be null if it is null it will thrown an exception. |
||
60 | * |
||
61 | * @return void |
||
62 | * @throws \Exception |
||
63 | */ |
||
64 | public function ensureSourceIsNotNull() |
||
68 | } |
||
69 | } |
||
70 | } |
||
71 |