Total Complexity | 5 |
Total Lines | 41 |
Duplicated Lines | 0 % |
Coverage | 71.43% |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
11 | trait HasDisksTrait |
||
12 | { |
||
13 | /** |
||
14 | * The array of resolved filesystem drivers. |
||
15 | * |
||
16 | * @var FileDisk[] |
||
17 | */ |
||
18 | protected $disks = []; |
||
19 | |||
20 | /** |
||
21 | * Get a filesystem instance. |
||
22 | * |
||
23 | * @param string $name |
||
24 | * @return FileDisk |
||
25 | */ |
||
26 | 1 | public function disk($name = null) |
|
27 | { |
||
28 | 1 | $name = $name ?: $this->getDefaultDriver(); |
|
29 | |||
30 | 1 | return $this->disks[$name] = $this->get($name); |
|
31 | } |
||
32 | |||
33 | /** |
||
34 | * Get the default driver name. |
||
35 | * |
||
36 | * @return string |
||
37 | */ |
||
38 | public function getDefaultDriver() |
||
41 | } |
||
42 | |||
43 | /** |
||
44 | * Attempt to get the disk from the local cache. |
||
45 | * |
||
46 | * @param string $name |
||
47 | * @return FileDisk |
||
48 | */ |
||
49 | 1 | protected function get($name) |
|
52 | } |
||
53 | } |
||
54 |