@@ -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 | |
@@ -223,9 +241,12 @@ discard block |
||
| 223 | 241 | */ |
| 224 | 242 | public function read( string $path ) : string |
| 225 | 243 | { |
| 226 | - try { |
|
| 244 | + try |
|
| 245 | + { |
|
| 227 | 246 | return $this->getProvider()->read( $path ); |
| 228 | - } catch( \Exception $e ) { |
|
| 247 | + } |
|
| 248 | + catch( \Exception $e ) |
|
| 249 | + { |
|
| 229 | 250 | throw new Exception( $e->getMessage(), 0, $e ); |
| 230 | 251 | } |
| 231 | 252 | } |
@@ -272,9 +293,12 @@ discard block |
||
| 272 | 293 | */ |
| 273 | 294 | public function reads( string $path ) |
| 274 | 295 | { |
| 275 | - try { |
|
| 296 | + try |
|
| 297 | + { |
|
| 276 | 298 | return $this->getProvider()->readStream( $path ); |
| 277 | - } catch( \Exception $e ) { |
|
| 299 | + } |
|
| 300 | + catch( \Exception $e ) |
|
| 301 | + { |
|
| 278 | 302 | throw new Exception( $e->getMessage(), 0, $e ); |
| 279 | 303 | } |
| 280 | 304 | } |
@@ -292,9 +316,12 @@ discard block |
||
| 292 | 316 | */ |
| 293 | 317 | public function write( string $path, string $content ) : Iface |
| 294 | 318 | { |
| 295 | - try { |
|
| 319 | + try |
|
| 320 | + { |
|
| 296 | 321 | $this->getProvider()->write( $path, $content ); |
| 297 | - } catch( \Exception $e ) { |
|
| 322 | + } |
|
| 323 | + catch( \Exception $e ) |
|
| 324 | + { |
|
| 298 | 325 | throw new Exception( $e->getMessage(), 0, $e ); |
| 299 | 326 | } |
| 300 | 327 | |
@@ -340,9 +367,12 @@ discard block |
||
| 340 | 367 | */ |
| 341 | 368 | public function writes( string $path, $stream ) : Iface |
| 342 | 369 | { |
| 343 | - try { |
|
| 370 | + try |
|
| 371 | + { |
|
| 344 | 372 | $this->getProvider()->writeStream( $path, $stream ); |
| 345 | - } catch( \Exception $e ) { |
|
| 373 | + } |
|
| 374 | + catch( \Exception $e ) |
|
| 375 | + { |
|
| 346 | 376 | throw new Exception( $e->getMessage(), 0, $e ); |
| 347 | 377 | } |
| 348 | 378 | |
@@ -360,9 +390,12 @@ discard block |
||
| 360 | 390 | */ |
| 361 | 391 | public function move( string $from, string $to ) : Iface |
| 362 | 392 | { |
| 363 | - try { |
|
| 393 | + try |
|
| 394 | + { |
|
| 364 | 395 | $this->getProvider()->move( $from, $to ); |
| 365 | - } catch( \Exception $e ) { |
|
| 396 | + } |
|
| 397 | + catch( \Exception $e ) |
|
| 398 | + { |
|
| 366 | 399 | throw new Exception( $e->getMessage(), 0, $e ); |
| 367 | 400 | } |
| 368 | 401 | |
@@ -380,9 +413,12 @@ discard block |
||
| 380 | 413 | */ |
| 381 | 414 | public function copy( string $from, string $to ) : Iface |
| 382 | 415 | { |
| 383 | - try { |
|
| 416 | + try |
|
| 417 | + { |
|
| 384 | 418 | $this->getProvider()->copy( $from, $to ); |
| 385 | - } catch( \Exception $e ) { |
|
| 419 | + } |
|
| 420 | + catch( \Exception $e ) |
|
| 421 | + { |
|
| 386 | 422 | throw new Exception( $e->getMessage(), 0, $e ); |
| 387 | 423 | } |
| 388 | 424 | |