Completed
Push — master ( 97eece...052b9e )
by Aimeos
03:38
created
lib/custom/src/MW/Filesystem/Laravel.php 1 patch
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	 *
28 28
 	 * @param string $basepath Root path to the file system
29 29
 	 */
30
-	public function __construct( \Illuminate\Contracts\Filesystem\Filesystem $fs )
30
+	public function __construct(\Illuminate\Contracts\Filesystem\Filesystem $fs)
31 31
 	{
32 32
 		$this->fs = $fs;
33 33
 	}
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
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
-		return in_array( basename( $path ), $this->fs->directories( dirname( $path ) ) );
45
+		return in_array(basename($path), $this->fs->directories(dirname($path)));
46 46
 	}
47 47
 
48 48
 
@@ -53,12 +53,12 @@  discard block
 block discarded – undo
53 53
 	 * @return void
54 54
 	 * @throws \Aimeos\MW\Filesystem\Exception If an error occurs
55 55
 	*/
56
-	public function mkdir( $path )
56
+	public function mkdir($path)
57 57
 	{
58 58
 		try {
59
-			$this->fs->makeDirectory( $path );
60
-		} catch( \Exception $e ) {
61
-			throw new Exception( $e->getMessage(), 0, $e );
59
+			$this->fs->makeDirectory($path);
60
+		} catch (\Exception $e) {
61
+			throw new Exception($e->getMessage(), 0, $e);
62 62
 		}
63 63
 	}
64 64
 
@@ -70,12 +70,12 @@  discard block
 block discarded – undo
70 70
 	 * @return void
71 71
 	 * @throws \Aimeos\MW\Filesystem\Exception If an error occurs
72 72
 	*/
73
-	public function rmdir( $path )
73
+	public function rmdir($path)
74 74
 	{
75 75
 		try {
76
-			$this->fs->deleteDirectory( $path );
77
-		} catch( \Exception $e ) {
78
-			throw new Exception( $e->getMessage(), 0, $e );
76
+			$this->fs->deleteDirectory($path);
77
+		} catch (\Exception $e) {
78
+			throw new Exception($e->getMessage(), 0, $e);
79 79
 		}
80 80
 	}
81 81
 
@@ -89,12 +89,12 @@  discard block
 block discarded – undo
89 89
 	 * @return \Iterator|array Iterator over the entries or array with entries
90 90
 	 * @throws \Aimeos\MW\Filesystem\Exception If an error occurs
91 91
 	 */
92
-	public function scan( $path = null )
92
+	public function scan($path = null)
93 93
 	{
94 94
 		try {
95
-			return array_merge( $this->fs->directories( $path ), $this->fs->files( $path ) );
96
-		} catch( \Exception $e ) {
97
-			throw new Exception( $e->getMessage(), 0, $e );
95
+			return array_merge($this->fs->directories($path), $this->fs->files($path));
96
+		} catch (\Exception $e) {
97
+			throw new Exception($e->getMessage(), 0, $e);
98 98
 		}
99 99
 	}
100 100
 
@@ -106,12 +106,12 @@  discard block
 block discarded – undo
106 106
 	 * @return integer Size in bytes
107 107
 	 * @throws \Aimeos\MW\Filesystem\Exception If an error occurs
108 108
 	 */
109
-	public function size( $path )
109
+	public function size($path)
110 110
 	{
111 111
 		try {
112
-			return $this->fs->size( $path );
113
-		} catch( \Exception $e ) {
114
-			throw new Exception( $e->getMessage(), 0, $e );
112
+			return $this->fs->size($path);
113
+		} catch (\Exception $e) {
114
+			throw new Exception($e->getMessage(), 0, $e);
115 115
 		}
116 116
 	}
117 117
 
@@ -123,12 +123,12 @@  discard block
 block discarded – undo
123 123
 	 * @return integer Unix time stamp in seconds
124 124
 	 * @throws \Aimeos\MW\Filesystem\Exception If an error occurs
125 125
 	 */
126
-	public function time( $path )
126
+	public function time($path)
127 127
 	{
128 128
 		try {
129
-			return $this->fs->lastModified( $path );
130
-		} catch( \Exception $e ) {
131
-			throw new Exception( $e->getMessage(), 0, $e );
129
+			return $this->fs->lastModified($path);
130
+		} catch (\Exception $e) {
131
+			throw new Exception($e->getMessage(), 0, $e);
132 132
 		}
133 133
 	}
134 134
 
@@ -140,12 +140,12 @@  discard block
 block discarded – undo
140 140
 	 * @return void
141 141
 	 * @throws \Aimeos\MW\Filesystem\Exception If an error occurs
142 142
 	 */
143
-	public function rm( $path )
143
+	public function rm($path)
144 144
 	{
145 145
 		try {
146
-			$this->fs->delete( $path );
147
-		} catch( \Exception $e ) {
148
-			throw new Exception( $e->getMessage(), 0, $e );
146
+			$this->fs->delete($path);
147
+		} catch (\Exception $e) {
148
+			throw new Exception($e->getMessage(), 0, $e);
149 149
 		}
150 150
 	}
151 151
 
@@ -156,9 +156,9 @@  discard block
 block discarded – undo
156 156
 	 * @param string $path Path to the file
157 157
 	 * @return boolean True if it exists, false if not
158 158
 	 */
159
-	public function has( $path )
159
+	public function has($path)
160 160
 	{
161
-		return $this->fs->exists( $path );
161
+		return $this->fs->exists($path);
162 162
 	}
163 163
 
164 164
 
@@ -171,12 +171,12 @@  discard block
 block discarded – undo
171 171
 	 * @return string File content
172 172
 	 * @throws \Aimeos\MW\Filesystem\Exception If an error occurs
173 173
 	 */
174
-	public function read( $path )
174
+	public function read($path)
175 175
 	{
176 176
 		try {
177
-			return $this->fs->get( $path );
178
-		} catch( \Exception $e ) {
179
-			throw new Exception( $e->getMessage(), 0, $e );
177
+			return $this->fs->get($path);
178
+		} catch (\Exception $e) {
179
+			throw new Exception($e->getMessage(), 0, $e);
180 180
 		}
181 181
 	}
182 182
 
@@ -190,27 +190,27 @@  discard block
 block discarded – undo
190 190
 	 * @return resource File stream descriptor
191 191
 	 * @throws \Aimeos\MW\Filesystem\Exception If an error occurs
192 192
 	 */
193
-	public function reads( $path )
193
+	public function reads($path)
194 194
 	{
195 195
 		try {
196
-			$content = $this->fs->get( $path );
197
-		} catch( \Exception $e ) {
198
-			throw new Exception( $e->getMessage(), 0, $e );
196
+			$content = $this->fs->get($path);
197
+		} catch (\Exception $e) {
198
+			throw new Exception($e->getMessage(), 0, $e);
199 199
 		}
200 200
 
201
-		if( ( $stream = tmpfile() ) === false ) {
201
+		if (($stream = tmpfile()) === false) {
202 202
 			$error = error_get_last();
203
-			throw new Exception( $error['message'] );
203
+			throw new Exception($error['message']);
204 204
 		}
205 205
 
206
-		if( fwrite( $stream, $content ) === false ) {
206
+		if (fwrite($stream, $content) === false) {
207 207
 			$error = error_get_last();
208
-			throw new Exception( $error['message'] );
208
+			throw new Exception($error['message']);
209 209
 		}
210 210
 
211
-		if( rewind( $stream ) === false ) {
211
+		if (rewind($stream) === false) {
212 212
 			$error = error_get_last();
213
-			throw new Exception( $error['message'] );
213
+			throw new Exception($error['message']);
214 214
 		}
215 215
 
216 216
 		return $stream;
@@ -227,12 +227,12 @@  discard block
 block discarded – undo
227 227
 	 * @return void
228 228
 	 * @throws \Aimeos\MW\Filesystem\Exception If an error occurs
229 229
 	 */
230
-	public function write( $path, $content )
230
+	public function write($path, $content)
231 231
 	{
232 232
 		try {
233
-			$this->fs->put( $path, $content );
234
-		} catch( \Exception $e ) {
235
-			throw new Exception( $e->getMessage(), 0, $e );
233
+			$this->fs->put($path, $content);
234
+		} catch (\Exception $e) {
235
+			throw new Exception($e->getMessage(), 0, $e);
236 236
 		}
237 237
 	}
238 238
 
@@ -247,17 +247,17 @@  discard block
 block discarded – undo
247 247
 	 * @return void
248 248
 	 * @throws \Aimeos\MW\Filesystem\Exception If an error occurs
249 249
 	 */
250
-	public function writes( $path, $stream )
250
+	public function writes($path, $stream)
251 251
 	{
252
-		if( ( $content = @fread( $stream, 0x7ffffffd ) ) === false ) {
252
+		if (($content = @fread($stream, 0x7ffffffd)) === false) {
253 253
 			$error = error_get_last();
254
-			throw new Exception( $error['message'] );
254
+			throw new Exception($error['message']);
255 255
 		}
256 256
 
257 257
 		try {
258
-			$content = $this->fs->put( $path, $content );
259
-		} catch( \Exception $e ) {
260
-			throw new Exception( $e->getMessage(), 0, $e );
258
+			$content = $this->fs->put($path, $content);
259
+		} catch (\Exception $e) {
260
+			throw new Exception($e->getMessage(), 0, $e);
261 261
 		}
262 262
 	}
263 263
 
@@ -270,12 +270,12 @@  discard block
 block discarded – undo
270 270
 	 * @return void
271 271
 	 * @throws \Aimeos\MW\Filesystem\Exception If an error occurs
272 272
 	 */
273
-	public function move( $from, $to )
273
+	public function move($from, $to)
274 274
 	{
275 275
 		try {
276
-			$this->fs->move( $from, $to );
277
-		} catch( \Exception $e ) {
278
-			throw new Exception( $e->getMessage(), 0, $e );
276
+			$this->fs->move($from, $to);
277
+		} catch (\Exception $e) {
278
+			throw new Exception($e->getMessage(), 0, $e);
279 279
 		}
280 280
 	}
281 281
 
@@ -288,12 +288,12 @@  discard block
 block discarded – undo
288 288
 	 * @return void
289 289
 	 * @throws \Aimeos\MW\Filesystem\Exception If an error occurs
290 290
 	 */
291
-	public function copy( $from, $to )
291
+	public function copy($from, $to)
292 292
 	{
293 293
 		try {
294
-			$this->fs->copy( $from, $to );
295
-		} catch( \Exception $e ) {
296
-			throw new Exception( $e->getMessage(), 0, $e );
294
+			$this->fs->copy($from, $to);
295
+		} catch (\Exception $e) {
296
+			throw new Exception($e->getMessage(), 0, $e);
297 297
 		}
298 298
 	}
299 299
 }
Please login to merge, or discard this patch.