1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace kalanis\kw_storage\Storage; |
4
|
|
|
|
5
|
|
|
|
6
|
|
|
use DateTimeInterface; |
7
|
|
|
use kalanis\kw_storage\Interfaces; |
8
|
|
|
|
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* Class StorageDirs |
12
|
|
|
* @package kalanis\kw_storage |
13
|
|
|
* Extended storage class |
14
|
|
|
*/ |
15
|
|
|
class StorageDirs extends Storage implements Interfaces\IPassDirs |
16
|
|
|
{ |
17
|
|
|
protected Interfaces\Target\ITargetVolume $targetVolume; |
18
|
|
|
|
19
|
25 |
|
public function __construct(Interfaces\Target\IKey $key, Interfaces\Target\ITargetVolume $target) |
20
|
|
|
{ |
21
|
25 |
|
parent::__construct($key, $target); |
22
|
25 |
|
$this->targetVolume = $target; |
23
|
|
|
} |
24
|
|
|
|
25
|
4 |
|
public function isDir(string $key): bool |
26
|
|
|
{ |
27
|
4 |
|
return $this->targetVolume->isDir($this->key->fromSharedKey($key)); |
28
|
|
|
} |
29
|
|
|
|
30
|
1 |
|
public function isFile(string $key): bool |
31
|
|
|
{ |
32
|
1 |
|
return $this->targetVolume->isFile($this->key->fromSharedKey($key)); |
33
|
|
|
} |
34
|
|
|
|
35
|
2 |
|
public function isReadable(string $key): bool |
36
|
|
|
{ |
37
|
2 |
|
return $this->targetVolume->isReadable($this->key->fromSharedKey($key)); |
38
|
|
|
} |
39
|
|
|
|
40
|
2 |
|
public function isWritable(string $key): bool |
41
|
|
|
{ |
42
|
2 |
|
return $this->targetVolume->isWritable($this->key->fromSharedKey($key)); |
43
|
|
|
} |
44
|
|
|
|
45
|
1 |
|
public function mkDir(string $key, bool $recursive = false): bool |
46
|
|
|
{ |
47
|
1 |
|
return $this->targetVolume->mkDir($this->key->fromSharedKey($key), $recursive); |
48
|
|
|
} |
49
|
|
|
|
50
|
1 |
|
public function rmDir(string $key, bool $recursive = false): bool |
51
|
|
|
{ |
52
|
1 |
|
return $this->targetVolume->rmDir($this->key->fromSharedKey($key), $recursive); |
53
|
|
|
} |
54
|
|
|
|
55
|
1 |
|
public function copy(string $source, string $dest): bool |
56
|
|
|
{ |
57
|
1 |
|
return $this->targetVolume->copy($this->key->fromSharedKey($source), $this->key->fromSharedKey($dest)); |
58
|
|
|
} |
59
|
|
|
|
60
|
1 |
|
public function move(string $source, string $dest): bool |
61
|
|
|
{ |
62
|
1 |
|
return $this->targetVolume->move($this->key->fromSharedKey($source), $this->key->fromSharedKey($dest)); |
63
|
|
|
} |
64
|
|
|
|
65
|
1 |
|
public function size(string $key): ?int |
66
|
|
|
{ |
67
|
1 |
|
return $this->targetVolume->size($this->key->fromSharedKey($key)); |
68
|
|
|
} |
69
|
|
|
|
70
|
1 |
|
public function created(string $key): ?DateTimeInterface |
71
|
|
|
{ |
72
|
1 |
|
return $this->targetVolume->created($this->key->fromSharedKey($key)); |
73
|
|
|
} |
74
|
|
|
} |
75
|
|
|
|