|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Dazzle\Filesystem; |
|
4
|
|
|
|
|
5
|
|
|
use Dazzle\Filesystem\Driver\DriverInterface; |
|
6
|
|
|
use Dazzle\Loop\LoopInterface; |
|
7
|
|
|
|
|
8
|
|
|
class Disk implements DiskInterface |
|
9
|
|
|
{ |
|
10
|
|
|
/** |
|
11
|
|
|
* @var DriverInterface |
|
12
|
|
|
*/ |
|
13
|
|
|
protected $driver; |
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* @param DriverInterface $driver |
|
17
|
|
|
*/ |
|
18
|
|
|
public function __construct(DriverInterface $driver) |
|
19
|
|
|
{ |
|
20
|
|
|
$this->driver = $driver; |
|
21
|
|
|
} |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* @override |
|
25
|
|
|
* @inheritDoc |
|
26
|
|
|
*/ |
|
27
|
|
|
public function setLoop(LoopInterface $loop = null) |
|
28
|
|
|
{ |
|
29
|
|
|
$this->driver->setLoop($loop); |
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* @override |
|
34
|
|
|
* @inheritDoc |
|
35
|
|
|
*/ |
|
36
|
|
|
public function getLoop() |
|
37
|
|
|
{ |
|
38
|
|
|
return $this->driver->getLoop(); |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* @override |
|
43
|
|
|
* @inheritDoc |
|
44
|
|
|
*/ |
|
45
|
|
|
public function access($path, $mode = 0755) |
|
46
|
|
|
{ |
|
47
|
|
|
return $this->driver->access($path, $mode); |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* @override |
|
52
|
|
|
* @inheritDoc |
|
53
|
|
|
*/ |
|
54
|
|
|
public function append($path, $data = '') |
|
55
|
|
|
{ |
|
56
|
|
|
return $this->driver->append($path, $data); |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* @override |
|
61
|
|
|
* @inheritDoc |
|
62
|
|
|
*/ |
|
63
|
|
|
public function chmod($path, $mode) |
|
64
|
|
|
{ |
|
65
|
|
|
return $this->driver->chmod($path, $mode); |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
/** |
|
69
|
|
|
* @override |
|
70
|
|
|
* @inheritDoc |
|
71
|
|
|
*/ |
|
72
|
|
|
public function chown($path, $uid = -1, $gid = -1) |
|
73
|
|
|
{ |
|
74
|
|
|
return $this->driver->chown($path, $uid, $gid); |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
|
|
/** |
|
78
|
|
|
* @override |
|
79
|
|
|
* @inheritDoc |
|
80
|
|
|
*/ |
|
81
|
|
|
public function exists($path) |
|
82
|
|
|
{ |
|
83
|
|
|
return $this->driver->exists($path); |
|
84
|
|
|
} |
|
85
|
|
|
|
|
86
|
|
|
/** |
|
87
|
|
|
* @override |
|
88
|
|
|
* @inheritDoc |
|
89
|
|
|
*/ |
|
90
|
|
|
public function link($srcPath, $dstPath) |
|
91
|
|
|
{ |
|
92
|
|
|
return $this->driver->link($srcPath, $dstPath); |
|
93
|
|
|
} |
|
94
|
|
|
|
|
95
|
|
|
/** |
|
96
|
|
|
* @override |
|
97
|
|
|
* @inheritDoc |
|
98
|
|
|
*/ |
|
99
|
|
|
public function ls($path) |
|
100
|
|
|
{ |
|
101
|
|
|
return $this->driver->ls($path); |
|
102
|
|
|
} |
|
103
|
|
|
|
|
104
|
|
|
/** |
|
105
|
|
|
* @override |
|
106
|
|
|
* @inheritDoc |
|
107
|
|
|
*/ |
|
108
|
|
|
public function mkdir($path, $mode = 0755) |
|
109
|
|
|
{ |
|
110
|
|
|
return $this->driver->mkdir($path, $mode); |
|
111
|
|
|
} |
|
112
|
|
|
|
|
113
|
|
|
/** |
|
114
|
|
|
* @override |
|
115
|
|
|
* @inheritDoc |
|
116
|
|
|
*/ |
|
117
|
|
|
public function prepend($path, $data = '') |
|
118
|
|
|
{ |
|
119
|
|
|
return $this->driver->prepend($path, $data); |
|
120
|
|
|
} |
|
121
|
|
|
|
|
122
|
|
|
/** |
|
123
|
|
|
* @override |
|
124
|
|
|
* @inheritDoc |
|
125
|
|
|
*/ |
|
126
|
|
|
public function readlink($path) |
|
127
|
|
|
{ |
|
128
|
|
|
return $this->driver->readlink($path); |
|
129
|
|
|
} |
|
130
|
|
|
|
|
131
|
|
|
/** |
|
132
|
|
|
* @override |
|
133
|
|
|
* @inheritDoc |
|
134
|
|
|
*/ |
|
135
|
|
|
public function realpath($path) |
|
136
|
|
|
{ |
|
137
|
|
|
return $this->driver->realpath($path); |
|
138
|
|
|
} |
|
139
|
|
|
|
|
140
|
|
|
/** |
|
141
|
|
|
* @override |
|
142
|
|
|
* @inheritDoc |
|
143
|
|
|
*/ |
|
144
|
|
|
public function rename($srcPath, $dstPath) |
|
145
|
|
|
{ |
|
146
|
|
|
return $this->driver->rename($srcPath, $dstPath); |
|
147
|
|
|
} |
|
148
|
|
|
|
|
149
|
|
|
/** |
|
150
|
|
|
* @override |
|
151
|
|
|
* @inheritDoc |
|
152
|
|
|
*/ |
|
153
|
|
|
public function rmdir($path) |
|
154
|
|
|
{ |
|
155
|
|
|
return $this->driver->rmdir($path); |
|
156
|
|
|
} |
|
157
|
|
|
|
|
158
|
|
|
/** |
|
159
|
|
|
* @override |
|
160
|
|
|
* @inheritDoc |
|
161
|
|
|
*/ |
|
162
|
|
|
public function stat($path) |
|
163
|
|
|
{ |
|
164
|
|
|
return $this->driver->stat($path); |
|
165
|
|
|
} |
|
166
|
|
|
|
|
167
|
|
|
/** |
|
168
|
|
|
* @override |
|
169
|
|
|
* @inheritDoc |
|
170
|
|
|
*/ |
|
171
|
|
|
public function symlink($srcPath, $dstPath) |
|
172
|
|
|
{ |
|
173
|
|
|
return $this->driver->symlink($srcPath, $dstPath); |
|
174
|
|
|
} |
|
175
|
|
|
|
|
176
|
|
|
/** |
|
177
|
|
|
* @override |
|
178
|
|
|
* @inheritDoc |
|
179
|
|
|
*/ |
|
180
|
|
|
public function truncate($path, $len = 0) |
|
181
|
|
|
{ |
|
182
|
|
|
return $this->driver->truncate($path, $len); |
|
183
|
|
|
} |
|
184
|
|
|
|
|
185
|
|
|
/** |
|
186
|
|
|
* @override |
|
187
|
|
|
* @inheritDoc |
|
188
|
|
|
*/ |
|
189
|
|
|
public function unlink($path) |
|
190
|
|
|
{ |
|
191
|
|
|
return $this->driver->unlink($path); |
|
192
|
|
|
} |
|
193
|
|
|
} |
|
194
|
|
|
|