1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Twistor\Flysystem; |
4
|
|
|
|
5
|
|
|
use League\Flysystem\AdapterInterface; |
6
|
|
|
use League\Flysystem\Config; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* An adapter that wraps another adapter. |
10
|
|
|
*/ |
11
|
|
|
class PassthroughAdapter implements AdapterInterface |
12
|
|
|
{ |
13
|
|
|
/** |
14
|
|
|
* The wrapped adapter. |
15
|
|
|
* |
16
|
|
|
* @var \League\Flysystem\AdapterInterface |
17
|
|
|
*/ |
18
|
|
|
private $adapter; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* Constructs a PassthroughAdapter object. |
22
|
|
|
* |
23
|
|
|
* @param \League\Flysystem\AdapterInterface $adapter The adapter to wrap. |
24
|
|
|
*/ |
25
|
3 |
|
public function __construct(AdapterInterface $adapter) |
26
|
|
|
{ |
27
|
3 |
|
$this->adapter = $adapter; |
28
|
3 |
|
} |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* Returns the wrapped adapter. |
32
|
|
|
* |
33
|
|
|
* Subclasses should use this to access the adapter when overriding methods. |
34
|
|
|
* |
35
|
|
|
* @return League\Flysystem\AdapterInterface |
36
|
|
|
*/ |
37
|
3 |
|
public function getAdapter() |
38
|
|
|
{ |
39
|
3 |
|
return $this->adapter; |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @inheritdoc |
44
|
|
|
*/ |
45
|
3 |
|
public function copy($path, $newpath) |
46
|
|
|
{ |
47
|
3 |
|
return $this->adapter->copy($path, $newpath); |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @inheritdoc |
52
|
|
|
*/ |
53
|
3 |
|
public function createDir($path, Config $config) |
54
|
|
|
{ |
55
|
3 |
|
return $this->adapter->createDir($path, $config); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @inheritdoc |
60
|
|
|
*/ |
61
|
3 |
|
public function delete($path) |
62
|
|
|
{ |
63
|
3 |
|
return $this->adapter->delete($path); |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* @inheritdoc |
68
|
|
|
*/ |
69
|
3 |
|
public function deleteDir($path) |
70
|
|
|
{ |
71
|
3 |
|
return $this->adapter->deleteDir($path); |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* @inheritdoc |
76
|
|
|
*/ |
77
|
3 |
|
public function getMetadata($path) |
78
|
|
|
{ |
79
|
3 |
|
return $this->adapter->getMetadata($path); |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* @inheritdoc |
84
|
|
|
*/ |
85
|
3 |
|
public function getMimetype($path) |
86
|
|
|
{ |
87
|
3 |
|
return $this->adapter->getMimetype($path); |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* @inheritdoc |
92
|
|
|
*/ |
93
|
3 |
|
public function getSize($path) |
94
|
|
|
{ |
95
|
3 |
|
return $this->adapter->getSize($path); |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* @inheritdoc |
100
|
|
|
*/ |
101
|
3 |
|
public function getTimestamp($path) |
102
|
|
|
{ |
103
|
3 |
|
return $this->adapter->getTimestamp($path); |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* @inheritdoc |
108
|
|
|
*/ |
109
|
3 |
|
public function getVisibility($path) |
110
|
|
|
{ |
111
|
3 |
|
return $this->adapter->getVisibility($path); |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* @inheritdoc |
116
|
|
|
*/ |
117
|
3 |
|
public function has($path) |
118
|
|
|
{ |
119
|
3 |
|
return $this->adapter->has($path); |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* @inheritdoc |
124
|
|
|
*/ |
125
|
3 |
|
public function listContents($directory = '', $recursive = false) |
126
|
|
|
{ |
127
|
3 |
|
return $this->adapter->listContents($directory, $recursive); |
128
|
|
|
} |
129
|
|
|
|
130
|
|
|
/** |
131
|
|
|
* @inheritdoc |
132
|
|
|
*/ |
133
|
3 |
|
public function read($path) |
134
|
|
|
{ |
135
|
3 |
|
return $this->adapter->read($path); |
136
|
|
|
} |
137
|
|
|
|
138
|
|
|
/** |
139
|
|
|
* @inheritdoc |
140
|
|
|
*/ |
141
|
3 |
|
public function readStream($path) |
142
|
|
|
{ |
143
|
3 |
|
return $this->adapter->readStream($path); |
144
|
|
|
} |
145
|
|
|
|
146
|
|
|
/** |
147
|
|
|
* @inheritdoc |
148
|
|
|
*/ |
149
|
3 |
|
public function rename($path, $newpath) |
150
|
|
|
{ |
151
|
3 |
|
return $this->adapter->rename($path, $newpath); |
152
|
|
|
} |
153
|
|
|
|
154
|
|
|
/** |
155
|
|
|
* @inheritdoc |
156
|
|
|
*/ |
157
|
3 |
|
public function setVisibility($path, $visibility) |
158
|
|
|
{ |
159
|
3 |
|
return $this->adapter->setVisibility($path, $visibility); |
160
|
|
|
} |
161
|
|
|
|
162
|
|
|
/** |
163
|
|
|
* @inheritdoc |
164
|
|
|
*/ |
165
|
3 |
|
public function update($path, $contents, Config $config) |
166
|
|
|
{ |
167
|
3 |
|
return $this->adapter->update($path, $contents, $config); |
168
|
|
|
} |
169
|
|
|
|
170
|
|
|
/** |
171
|
|
|
* @inheritdoc |
172
|
|
|
*/ |
173
|
3 |
|
public function updateStream($path, $resource, Config $config) |
174
|
|
|
{ |
175
|
3 |
|
return $this->adapter->updateStream($path, $resource, $config); |
176
|
|
|
} |
177
|
|
|
|
178
|
|
|
/** |
179
|
|
|
* @inheritdoc |
180
|
|
|
*/ |
181
|
3 |
|
public function write($path, $contents, Config $config) |
182
|
|
|
{ |
183
|
3 |
|
return $this->adapter->write($path, $contents, $config); |
184
|
|
|
} |
185
|
|
|
|
186
|
|
|
/** |
187
|
|
|
* @inheritdoc |
188
|
|
|
*/ |
189
|
3 |
|
public function writeStream($path, $resource, Config $config) |
190
|
|
|
{ |
191
|
3 |
|
return $this->adapter->writeStream($path, $resource, $config); |
192
|
|
|
} |
193
|
|
|
} |
194
|
|
|
|