@@ -53,11 +53,14 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function isdir( string $path ) : bool |
55 | 55 | { |
56 | - try { |
|
56 | + try |
|
57 | + { |
|
57 | 58 | foreach( $this->getProvider()->listContents( $path ) as $attr ) { |
58 | 59 | return $attr->isDir(); |
59 | 60 | } |
60 | - } catch( \Exception $e ) { |
|
61 | + } |
|
62 | + catch( \Exception $e ) |
|
63 | + { |
|
61 | 64 | throw new Exception( $e->getMessage(), 0, $e ); |
62 | 65 | } |
63 | 66 | |
@@ -74,9 +77,12 @@ discard block |
||
74 | 77 | */ |
75 | 78 | public function mkdir( string $path ) : DirIface |
76 | 79 | { |
77 | - try { |
|
80 | + try |
|
81 | + { |
|
78 | 82 | $this->getProvider()->createDirectory( $path ); |
79 | - } catch( \Exception $e ) { |
|
83 | + } |
|
84 | + catch( \Exception $e ) |
|
85 | + { |
|
80 | 86 | throw new Exception( $e->getMessage(), 0, $e ); |
81 | 87 | } |
82 | 88 | |
@@ -93,9 +99,12 @@ discard block |
||
93 | 99 | */ |
94 | 100 | public function rmdir( string $path ) : DirIface |
95 | 101 | { |
96 | - try { |
|
102 | + try |
|
103 | + { |
|
97 | 104 | $this->getProvider()->deleteDirectory( $path ); |
98 | - } catch( \Exception $e ) { |
|
105 | + } |
|
106 | + catch( \Exception $e ) |
|
107 | + { |
|
99 | 108 | throw new Exception( $e->getMessage(), 0, $e ); |
100 | 109 | } |
101 | 110 | |
@@ -140,9 +149,12 @@ discard block |
||
140 | 149 | */ |
141 | 150 | public function size( string $path ) : int |
142 | 151 | { |
143 | - try { |
|
152 | + try |
|
153 | + { |
|
144 | 154 | return $this->getProvider()->fileSize( $path ); |
145 | - } catch( \Exception $e ) { |
|
155 | + } |
|
156 | + catch( \Exception $e ) |
|
157 | + { |
|
146 | 158 | throw new Exception( $e->getMessage(), 0, $e ); |
147 | 159 | } |
148 | 160 | } |
@@ -157,9 +169,12 @@ discard block |
||
157 | 169 | */ |
158 | 170 | public function time( string $path ) : int |
159 | 171 | { |
160 | - try { |
|
172 | + try |
|
173 | + { |
|
161 | 174 | return $this->getProvider()->lastModified( $path ); |
162 | - } catch( \Exception $e ) { |
|
175 | + } |
|
176 | + catch( \Exception $e ) |
|
177 | + { |
|
163 | 178 | throw new Exception( $e->getMessage(), 0, $e ); |
164 | 179 | } |
165 | 180 | } |
@@ -174,9 +189,12 @@ discard block |
||
174 | 189 | */ |
175 | 190 | public function rm( string $path ) : Iface |
176 | 191 | { |
177 | - try { |
|
192 | + try |
|
193 | + { |
|
178 | 194 | $this->getProvider()->delete( $path ); |
179 | - } catch( \Exception $e ) { |
|
195 | + } |
|
196 | + catch( \Exception $e ) |
|
197 | + { |
|
180 | 198 | throw new Exception( $e->getMessage(), 0, $e ); |
181 | 199 | } |
182 | 200 | |
@@ -192,9 +210,12 @@ discard block |
||
192 | 210 | */ |
193 | 211 | public function has( string $path ) : bool |
194 | 212 | { |
195 | - try { |
|
213 | + try |
|
214 | + { |
|
196 | 215 | return $this->getProvider()->has( $path ); |
197 | - } catch( \Exception $e ) { |
|
216 | + } |
|
217 | + catch( \Exception $e ) |
|
218 | + { |
|
198 | 219 | throw new Exception( $e->getMessage(), 0, $e ); |
199 | 220 | } |
200 | 221 | } |
@@ -211,9 +232,12 @@ discard block |
||
211 | 232 | */ |
212 | 233 | public function read( string $path ) : string |
213 | 234 | { |
214 | - try { |
|
235 | + try |
|
236 | + { |
|
215 | 237 | return $this->getProvider()->read( $path ); |
216 | - } catch( \Exception $e ) { |
|
238 | + } |
|
239 | + catch( \Exception $e ) |
|
240 | + { |
|
217 | 241 | throw new Exception( $e->getMessage(), 0, $e ); |
218 | 242 | } |
219 | 243 | } |
@@ -260,9 +284,12 @@ discard block |
||
260 | 284 | */ |
261 | 285 | public function reads( string $path ) |
262 | 286 | { |
263 | - try { |
|
287 | + try |
|
288 | + { |
|
264 | 289 | return $this->getProvider()->readStream( $path ); |
265 | - } catch( \Exception $e ) { |
|
290 | + } |
|
291 | + catch( \Exception $e ) |
|
292 | + { |
|
266 | 293 | throw new Exception( $e->getMessage(), 0, $e ); |
267 | 294 | } |
268 | 295 | } |
@@ -280,9 +307,12 @@ discard block |
||
280 | 307 | */ |
281 | 308 | public function write( string $path, string $content ) : Iface |
282 | 309 | { |
283 | - try { |
|
310 | + try |
|
311 | + { |
|
284 | 312 | $this->getProvider()->write( $path, $content ); |
285 | - } catch( \Exception $e ) { |
|
313 | + } |
|
314 | + catch( \Exception $e ) |
|
315 | + { |
|
286 | 316 | throw new Exception( $e->getMessage(), 0, $e ); |
287 | 317 | } |
288 | 318 | |
@@ -328,9 +358,12 @@ discard block |
||
328 | 358 | */ |
329 | 359 | public function writes( string $path, $stream ) : Iface |
330 | 360 | { |
331 | - try { |
|
361 | + try |
|
362 | + { |
|
332 | 363 | $this->getProvider()->writeStream( $path, $stream ); |
333 | - } catch( \Exception $e ) { |
|
364 | + } |
|
365 | + catch( \Exception $e ) |
|
366 | + { |
|
334 | 367 | throw new Exception( $e->getMessage(), 0, $e ); |
335 | 368 | } |
336 | 369 | |
@@ -348,9 +381,12 @@ discard block |
||
348 | 381 | */ |
349 | 382 | public function move( string $from, string $to ) : Iface |
350 | 383 | { |
351 | - try { |
|
384 | + try |
|
385 | + { |
|
352 | 386 | $this->getProvider()->move( $from, $to ); |
353 | - } catch( \Exception $e ) { |
|
387 | + } |
|
388 | + catch( \Exception $e ) |
|
389 | + { |
|
354 | 390 | throw new Exception( $e->getMessage(), 0, $e ); |
355 | 391 | } |
356 | 392 | |
@@ -368,9 +404,12 @@ discard block |
||
368 | 404 | */ |
369 | 405 | public function copy( string $from, string $to ) : Iface |
370 | 406 | { |
371 | - try { |
|
407 | + try |
|
408 | + { |
|
372 | 409 | $this->getProvider()->copy( $from, $to ); |
373 | - } catch( \Exception $e ) { |
|
410 | + } |
|
411 | + catch( \Exception $e ) |
|
412 | + { |
|
374 | 413 | throw new Exception( $e->getMessage(), 0, $e ); |
375 | 414 | } |
376 | 415 |