@@ -33,19 +33,19 @@ |
||
33 | 33 | */ |
34 | 34 | protected function getProvider() |
35 | 35 | { |
36 | - if( !isset( $this->fs ) ) |
|
36 | + if (!isset($this->fs)) |
|
37 | 37 | { |
38 | 38 | $config = $this->getConfig(); |
39 | 39 | |
40 | - if( !isset( $config['bucket'] ) ) { |
|
41 | - throw new Exception( sprintf( 'Configuration option "%1$s" missing', 'bucket' ) ); |
|
40 | + if (!isset($config['bucket'])) { |
|
41 | + throw new Exception(sprintf('Configuration option "%1$s" missing', 'bucket')); |
|
42 | 42 | } |
43 | 43 | |
44 | - $prefix = ( isset( $config['prefix'] ) ? $config['prefix'] : null ); |
|
44 | + $prefix = (isset($config['prefix']) ? $config['prefix'] : null); |
|
45 | 45 | |
46 | - $client = S3Client::factory( $config ); |
|
47 | - $adapter = new AwsS3Adapter( $client, $config['bucket'], $prefix ); |
|
48 | - $this->fs = new Filesystem( $adapter ); |
|
46 | + $client = S3Client::factory($config); |
|
47 | + $adapter = new AwsS3Adapter($client, $config['bucket'], $prefix); |
|
48 | + $this->fs = new Filesystem($adapter); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | return $this->fs; |
@@ -33,20 +33,20 @@ |
||
33 | 33 | */ |
34 | 34 | protected function getProvider() |
35 | 35 | { |
36 | - if( !isset( $this->fs ) ) |
|
36 | + if (!isset($this->fs)) |
|
37 | 37 | { |
38 | 38 | $config = $this->getConfig(); |
39 | 39 | |
40 | - if( !isset( $config['endpoint'] ) ) { |
|
41 | - throw new Exception( sprintf( 'Configuration option "%1$s" missing', 'endpoint' ) ); |
|
40 | + if (!isset($config['endpoint'])) { |
|
41 | + throw new Exception(sprintf('Configuration option "%1$s" missing', 'endpoint')); |
|
42 | 42 | } |
43 | 43 | |
44 | - if( !isset( $config['container'] ) ) { |
|
45 | - throw new Exception( sprintf( 'Configuration option "%1$s" missing', 'container' ) ); |
|
44 | + if (!isset($config['container'])) { |
|
45 | + throw new Exception(sprintf('Configuration option "%1$s" missing', 'container')); |
|
46 | 46 | } |
47 | 47 | |
48 | - $service = ServicesBuilder::getInstance()->createBlobService( $config['endpoint'] ); |
|
49 | - $this->fs = new Filesystem( new AzureAdapter( $service, $config['container'] ) ); |
|
48 | + $service = ServicesBuilder::getInstance()->createBlobService($config['endpoint']); |
|
49 | + $this->fs = new Filesystem(new AzureAdapter($service, $config['container'])); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | return $this->fs; |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * |
28 | 28 | * @param array $config Configuration options |
29 | 29 | */ |
30 | - public function __construct( array $config ) |
|
30 | + public function __construct(array $config) |
|
31 | 31 | { |
32 | 32 | $this->config = $config; |
33 | 33 | } |
@@ -40,11 +40,11 @@ discard block |
||
40 | 40 | * @return boolean True if directory, false if not |
41 | 41 | * @throws \Aimeos\MW\Filesystem\Exception If an error occurs |
42 | 42 | */ |
43 | - public function isdir( $path ) |
|
43 | + public function isdir($path) |
|
44 | 44 | { |
45 | - $result = $this->getProvider()->getMetadata( $path ); |
|
45 | + $result = $this->getProvider()->getMetadata($path); |
|
46 | 46 | |
47 | - if( $result['type'] === 'dir' ) { |
|
47 | + if ($result['type'] === 'dir') { |
|
48 | 48 | return true; |
49 | 49 | } |
50 | 50 | |
@@ -59,10 +59,10 @@ discard block |
||
59 | 59 | * @return void |
60 | 60 | * @throws \Aimeos\MW\Filesystem\Exception If an error occurs |
61 | 61 | */ |
62 | - public function mkdir( $path ) |
|
62 | + public function mkdir($path) |
|
63 | 63 | { |
64 | - if( $this->getProvider()->createDir( $path ) === false ) { |
|
65 | - throw new Exception( $path ); |
|
64 | + if ($this->getProvider()->createDir($path) === false) { |
|
65 | + throw new Exception($path); |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 | |
@@ -74,10 +74,10 @@ discard block |
||
74 | 74 | * @return void |
75 | 75 | * @throws \Aimeos\MW\Filesystem\Exception If an error occurs |
76 | 76 | */ |
77 | - public function rmdir( $path ) |
|
77 | + public function rmdir($path) |
|
78 | 78 | { |
79 | - if( $this->getProvider()->deleteDir( $path ) === false ) { |
|
80 | - throw new Exception( $path ); |
|
79 | + if ($this->getProvider()->deleteDir($path) === false) { |
|
80 | + throw new Exception($path); |
|
81 | 81 | } |
82 | 82 | } |
83 | 83 | |
@@ -91,11 +91,11 @@ discard block |
||
91 | 91 | * @return \Iterator|array Iterator over the entries or array with entries |
92 | 92 | * @throws \Aimeos\MW\Filesystem\Exception If an error occurs |
93 | 93 | */ |
94 | - public function scan( $path = null ) |
|
94 | + public function scan($path = null) |
|
95 | 95 | { |
96 | 96 | $list = array(); |
97 | 97 | |
98 | - foreach( $this->getProvider()->listContents( $path ) as $entry ) { |
|
98 | + foreach ($this->getProvider()->listContents($path) as $entry) { |
|
99 | 99 | $list[] = $entry['basename']; |
100 | 100 | } |
101 | 101 | |
@@ -110,16 +110,16 @@ discard block |
||
110 | 110 | * @return integer Size in bytes |
111 | 111 | * @throws \Aimeos\MW\Filesystem\Exception If an error occurs |
112 | 112 | */ |
113 | - public function size( $path ) |
|
113 | + public function size($path) |
|
114 | 114 | { |
115 | 115 | try { |
116 | - $size = $this->getProvider()->getSize( $path ); |
|
117 | - } catch( \Exception $e ) { |
|
118 | - throw new Exception( $e->getMessage(), 0, $e ); |
|
116 | + $size = $this->getProvider()->getSize($path); |
|
117 | + } catch (\Exception $e) { |
|
118 | + throw new Exception($e->getMessage(), 0, $e); |
|
119 | 119 | } |
120 | 120 | |
121 | - if( $size === false ) { |
|
122 | - throw new Exception( $path ); |
|
121 | + if ($size === false) { |
|
122 | + throw new Exception($path); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | return $size; |
@@ -133,16 +133,16 @@ discard block |
||
133 | 133 | * @return integer Unix time stamp in seconds |
134 | 134 | * @throws \Aimeos\MW\Filesystem\Exception If an error occurs |
135 | 135 | */ |
136 | - public function time( $path ) |
|
136 | + public function time($path) |
|
137 | 137 | { |
138 | 138 | try { |
139 | - $time = $this->getProvider()->getTimestamp( $path ); |
|
140 | - } catch( \Exception $e ) { |
|
141 | - throw new Exception( $e->getMessage(), 0, $e ); |
|
139 | + $time = $this->getProvider()->getTimestamp($path); |
|
140 | + } catch (\Exception $e) { |
|
141 | + throw new Exception($e->getMessage(), 0, $e); |
|
142 | 142 | } |
143 | 143 | |
144 | - if( $time === false ) { |
|
145 | - throw new Exception( $path ); |
|
144 | + if ($time === false) { |
|
145 | + throw new Exception($path); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | return $time; |
@@ -156,12 +156,12 @@ discard block |
||
156 | 156 | * @return void |
157 | 157 | * @throws \Aimeos\MW\Filesystem\Exception If an error occurs |
158 | 158 | */ |
159 | - public function rm( $path ) |
|
159 | + public function rm($path) |
|
160 | 160 | { |
161 | 161 | try { |
162 | - $this->getProvider()->delete( $path ); |
|
163 | - } catch( \Exception $e ) { |
|
164 | - throw new Exception( $e->getMessage(), 0, $e ); |
|
162 | + $this->getProvider()->delete($path); |
|
163 | + } catch (\Exception $e) { |
|
164 | + throw new Exception($e->getMessage(), 0, $e); |
|
165 | 165 | } |
166 | 166 | } |
167 | 167 | |
@@ -172,9 +172,9 @@ discard block |
||
172 | 172 | * @param string $path Path to the file |
173 | 173 | * @return boolean True if it exists, false if not |
174 | 174 | */ |
175 | - public function has( $path ) |
|
175 | + public function has($path) |
|
176 | 176 | { |
177 | - return $this->getProvider()->has( $path ); |
|
177 | + return $this->getProvider()->has($path); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | |
@@ -187,16 +187,16 @@ discard block |
||
187 | 187 | * @return string File content |
188 | 188 | * @throws \Aimeos\MW\Filesystem\Exception If an error occurs |
189 | 189 | */ |
190 | - public function read( $path ) |
|
190 | + public function read($path) |
|
191 | 191 | { |
192 | 192 | try { |
193 | - $content = $this->getProvider()->read( $path ); |
|
194 | - } catch( \Exception $e ) { |
|
195 | - throw new Exception( $e->getMessage(), 0, $e ); |
|
193 | + $content = $this->getProvider()->read($path); |
|
194 | + } catch (\Exception $e) { |
|
195 | + throw new Exception($e->getMessage(), 0, $e); |
|
196 | 196 | } |
197 | 197 | |
198 | - if( $content === false ) { |
|
199 | - throw new Exception( $path ); |
|
198 | + if ($content === false) { |
|
199 | + throw new Exception($path); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | return $content; |
@@ -212,16 +212,16 @@ discard block |
||
212 | 212 | * @return resource File stream descriptor |
213 | 213 | * @throws \Aimeos\MW\Filesystem\Exception If an error occurs |
214 | 214 | */ |
215 | - public function reads( $path ) |
|
215 | + public function reads($path) |
|
216 | 216 | { |
217 | 217 | try { |
218 | - $handle = $this->getProvider()->readStream( $path ); |
|
219 | - } catch( \Exception $e ) { |
|
220 | - throw new Exception( $e->getMessage(), 0, $e ); |
|
218 | + $handle = $this->getProvider()->readStream($path); |
|
219 | + } catch (\Exception $e) { |
|
220 | + throw new Exception($e->getMessage(), 0, $e); |
|
221 | 221 | } |
222 | 222 | |
223 | - if( $handle === false ) { |
|
224 | - throw new Exception( $path ); |
|
223 | + if ($handle === false) { |
|
224 | + throw new Exception($path); |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | return $handle; |
@@ -238,16 +238,16 @@ discard block |
||
238 | 238 | * @return void |
239 | 239 | * @throws \Aimeos\MW\Filesystem\Exception If an error occurs |
240 | 240 | */ |
241 | - public function write( $path, $content ) |
|
241 | + public function write($path, $content) |
|
242 | 242 | { |
243 | 243 | try { |
244 | - $result = $this->getProvider()->put( $path, $content ); |
|
245 | - } catch( \Exception $e ) { |
|
246 | - throw new Exception( $e->getMessage(), 0, $e ); |
|
244 | + $result = $this->getProvider()->put($path, $content); |
|
245 | + } catch (\Exception $e) { |
|
246 | + throw new Exception($e->getMessage(), 0, $e); |
|
247 | 247 | } |
248 | 248 | |
249 | - if( $result === false ) { |
|
250 | - throw new Exception( $path ); |
|
249 | + if ($result === false) { |
|
250 | + throw new Exception($path); |
|
251 | 251 | } |
252 | 252 | } |
253 | 253 | |
@@ -262,16 +262,16 @@ discard block |
||
262 | 262 | * @return void |
263 | 263 | * @throws \Aimeos\MW\Filesystem\Exception If an error occurs |
264 | 264 | */ |
265 | - public function writes( $path, $stream ) |
|
265 | + public function writes($path, $stream) |
|
266 | 266 | { |
267 | 267 | try { |
268 | - $result = $this->getProvider()->putStream( $path, $stream ); |
|
269 | - } catch( \Exception $e ) { |
|
270 | - throw new Exception( $e->getMessage(), 0, $e ); |
|
268 | + $result = $this->getProvider()->putStream($path, $stream); |
|
269 | + } catch (\Exception $e) { |
|
270 | + throw new Exception($e->getMessage(), 0, $e); |
|
271 | 271 | } |
272 | 272 | |
273 | - if( $result === false ) { |
|
274 | - throw new Exception( $path ); |
|
273 | + if ($result === false) { |
|
274 | + throw new Exception($path); |
|
275 | 275 | } |
276 | 276 | } |
277 | 277 | |
@@ -284,16 +284,16 @@ discard block |
||
284 | 284 | * @return void |
285 | 285 | * @throws \Aimeos\MW\Filesystem\Exception If an error occurs |
286 | 286 | */ |
287 | - public function move( $from, $to ) |
|
287 | + public function move($from, $to) |
|
288 | 288 | { |
289 | 289 | try { |
290 | - $result = $this->getProvider()->rename( $from, $to ); |
|
291 | - } catch( \Exception $e ) { |
|
292 | - throw new Exception( $e->getMessage(), 0, $e ); |
|
290 | + $result = $this->getProvider()->rename($from, $to); |
|
291 | + } catch (\Exception $e) { |
|
292 | + throw new Exception($e->getMessage(), 0, $e); |
|
293 | 293 | } |
294 | 294 | |
295 | - if( $result === false ) { |
|
296 | - throw new Exception( sprintf( 'Error moving "%1$s" to "%2$s"', $from, $to ) ); |
|
295 | + if ($result === false) { |
|
296 | + throw new Exception(sprintf('Error moving "%1$s" to "%2$s"', $from, $to)); |
|
297 | 297 | } |
298 | 298 | } |
299 | 299 | |
@@ -306,16 +306,16 @@ discard block |
||
306 | 306 | * @return void |
307 | 307 | * @throws \Aimeos\MW\Filesystem\Exception If an error occurs |
308 | 308 | */ |
309 | - public function copy( $from, $to ) |
|
309 | + public function copy($from, $to) |
|
310 | 310 | { |
311 | 311 | try { |
312 | - $result = $this->getProvider()->copy( $from, $to ); |
|
313 | - } catch( \Exception $e ) { |
|
314 | - throw new Exception( $e->getMessage(), 0, $e ); |
|
312 | + $result = $this->getProvider()->copy($from, $to); |
|
313 | + } catch (\Exception $e) { |
|
314 | + throw new Exception($e->getMessage(), 0, $e); |
|
315 | 315 | } |
316 | 316 | |
317 | - if( $result === false ) { |
|
318 | - throw new Exception( sprintf( 'Error copying "%1$s" to "%2$s"', $from, $to ) ); |
|
317 | + if ($result === false) { |
|
318 | + throw new Exception(sprintf('Error copying "%1$s" to "%2$s"', $from, $to)); |
|
319 | 319 | } |
320 | 320 | } |
321 | 321 |
@@ -33,30 +33,30 @@ |
||
33 | 33 | */ |
34 | 34 | protected function getProvider() |
35 | 35 | { |
36 | - if( !isset( $this->fs ) ) |
|
36 | + if (!isset($this->fs)) |
|
37 | 37 | { |
38 | 38 | $config = $this->getConfig(); |
39 | 39 | |
40 | - if( !isset( $config['consumerkey'] ) ) { |
|
41 | - throw new Exception( sprintf( 'Configuration option "%1$s" missing', 'consumerkey' ) ); |
|
40 | + if (!isset($config['consumerkey'])) { |
|
41 | + throw new Exception(sprintf('Configuration option "%1$s" missing', 'consumerkey')); |
|
42 | 42 | } |
43 | 43 | |
44 | - if( !isset( $config['consumersecret'] ) ) { |
|
45 | - throw new Exception( sprintf( 'Configuration option "%1$s" missing', 'consumersecret' ) ); |
|
44 | + if (!isset($config['consumersecret'])) { |
|
45 | + throw new Exception(sprintf('Configuration option "%1$s" missing', 'consumersecret')); |
|
46 | 46 | } |
47 | 47 | |
48 | - if( !isset( $config['accesstoken'] ) ) { |
|
49 | - throw new Exception( sprintf( 'Configuration option "%1$s" missing', 'accesstoken' ) ); |
|
48 | + if (!isset($config['accesstoken'])) { |
|
49 | + throw new Exception(sprintf('Configuration option "%1$s" missing', 'accesstoken')); |
|
50 | 50 | } |
51 | 51 | |
52 | - if( !isset( $config['tokensecret'] ) ) { |
|
53 | - throw new Exception( sprintf( 'Configuration option "%1$s" missing', 'tokensecret' ) ); |
|
52 | + if (!isset($config['tokensecret'])) { |
|
53 | + throw new Exception(sprintf('Configuration option "%1$s" missing', 'tokensecret')); |
|
54 | 54 | } |
55 | 55 | |
56 | - $prefix = ( isset( $config['prefix'] ) ? $config['prefix'] : null ); |
|
56 | + $prefix = (isset($config['prefix']) ? $config['prefix'] : null); |
|
57 | 57 | |
58 | - $client = new API( $config['consumerkey'], $config['consumersecret'], $config['accesstoken'], $config['tokensecret'] ); |
|
59 | - $this->fs = new Filesystem( new CopyAdapter( $client, $prefix ) ); |
|
58 | + $client = new API($config['consumerkey'], $config['consumersecret'], $config['accesstoken'], $config['tokensecret']); |
|
59 | + $this->fs = new Filesystem(new CopyAdapter($client, $prefix)); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | return $this->fs; |
@@ -33,22 +33,22 @@ |
||
33 | 33 | */ |
34 | 34 | protected function getProvider() |
35 | 35 | { |
36 | - if( !isset( $this->fs ) ) |
|
36 | + if (!isset($this->fs)) |
|
37 | 37 | { |
38 | 38 | $config = $this->getConfig(); |
39 | 39 | |
40 | - if( !isset( $config['accesstoken'] ) ) { |
|
41 | - throw new Exception( sprintf( 'Configuration option "%1$s" missing', 'accesstoken' ) ); |
|
40 | + if (!isset($config['accesstoken'])) { |
|
41 | + throw new Exception(sprintf('Configuration option "%1$s" missing', 'accesstoken')); |
|
42 | 42 | } |
43 | 43 | |
44 | - if( !isset( $config['appsecret'] ) ) { |
|
45 | - throw new Exception( sprintf( 'Configuration option "%1$s" missing', 'appsecret' ) ); |
|
44 | + if (!isset($config['appsecret'])) { |
|
45 | + throw new Exception(sprintf('Configuration option "%1$s" missing', 'appsecret')); |
|
46 | 46 | } |
47 | 47 | |
48 | - $prefix = ( isset( $config['prefix'] ) ? $config['prefix'] : null ); |
|
48 | + $prefix = (isset($config['prefix']) ? $config['prefix'] : null); |
|
49 | 49 | |
50 | - $client = new Client( $config['accesstoken'], $config['appsecret'] ); |
|
51 | - $this->fs = new Filesystem( new DropboxAdapter( $client, $prefix ) ); |
|
50 | + $client = new Client($config['accesstoken'], $config['appsecret']); |
|
51 | + $this->fs = new Filesystem(new DropboxAdapter($client, $prefix)); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | return $this->fs; |
@@ -32,10 +32,10 @@ |
||
32 | 32 | */ |
33 | 33 | protected function getProvider() |
34 | 34 | { |
35 | - if( !isset( $this->fs ) ) |
|
35 | + if (!isset($this->fs)) |
|
36 | 36 | { |
37 | 37 | $config = $this->getConfig(); |
38 | - $this->fs = new Filesystem( new FtpAdapter( $config ) ); |
|
38 | + $this->fs = new Filesystem(new FtpAdapter($config)); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | return $this->fs; |
@@ -32,16 +32,16 @@ |
||
32 | 32 | */ |
33 | 33 | protected function getProvider() |
34 | 34 | { |
35 | - if( !isset( $this->fs ) ) |
|
35 | + if (!isset($this->fs)) |
|
36 | 36 | { |
37 | 37 | $config = $this->getConfig(); |
38 | 38 | |
39 | - if( !isset( $config['dbname'] ) ) { |
|
40 | - throw new Exception( sprintf( 'Configuration option "%1$s" missing', 'dbname' ) ); |
|
39 | + if (!isset($config['dbname'])) { |
|
40 | + throw new Exception(sprintf('Configuration option "%1$s" missing', 'dbname')); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | $client = new \MongoClient(); |
44 | - $this->fs = new Filesystem( new GridFSAdapter( $client->selectDB( $config['dbname'] )->getGridFS() ) ); |
|
44 | + $this->fs = new Filesystem(new GridFSAdapter($client->selectDB($config['dbname'])->getGridFS())); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | return $this->fs; |
@@ -32,16 +32,16 @@ |
||
32 | 32 | */ |
33 | 33 | protected function getProvider() |
34 | 34 | { |
35 | - if( !isset( $this->fs ) ) |
|
35 | + if (!isset($this->fs)) |
|
36 | 36 | { |
37 | 37 | $config = $this->getConfig(); |
38 | 38 | |
39 | - if( !isset( $config['basedir'] ) ) { |
|
40 | - throw new Exception( sprintf( 'Configuration option "%1$s" missing', 'basedir' ) ); |
|
39 | + if (!isset($config['basedir'])) { |
|
40 | + throw new Exception(sprintf('Configuration option "%1$s" missing', 'basedir')); |
|
41 | 41 | } |
42 | 42 | |
43 | - $adapter = new Local( $config['basedir'], LOCK_EX, Local::SKIP_LINKS, $config ); |
|
44 | - $this->fs = new Filesystem( $adapter ); |
|
43 | + $adapter = new Local($config['basedir'], LOCK_EX, Local::SKIP_LINKS, $config); |
|
44 | + $this->fs = new Filesystem($adapter); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | return $this->fs; |
@@ -32,8 +32,8 @@ |
||
32 | 32 | */ |
33 | 33 | protected function getProvider() |
34 | 34 | { |
35 | - if( !isset( $this->fs ) ) { |
|
36 | - $this->fs = new Filesystem( new MemoryAdapter() ); |
|
35 | + if (!isset($this->fs)) { |
|
36 | + $this->fs = new Filesystem(new MemoryAdapter()); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | return $this->fs; |