@@ -54,8 +54,7 @@ discard block |
||
54 | 54 | * Class File |
55 | 55 | * @package Platine\Filesystem\Adapter\Local |
56 | 56 | */ |
57 | -class File extends AbstractLocal implements FileInterface |
|
58 | -{ |
|
57 | +class File extends AbstractLocal implements FileInterface { |
|
59 | 58 | |
60 | 59 | /** |
61 | 60 | * {@inheritdoc} |
@@ -70,8 +69,7 @@ discard block |
||
70 | 69 | /** |
71 | 70 | * {@inheritdoc} |
72 | 71 | */ |
73 | - public function copyTo($directory, int $mode = 0775) |
|
74 | - { |
|
72 | + public function copyTo($directory, int $mode = 0775) { |
|
75 | 73 | if (is_string($directory)) { |
76 | 74 | $directory = $this->adapter->directory($directory); |
77 | 75 | } |
@@ -86,8 +84,7 @@ discard block |
||
86 | 84 | /** |
87 | 85 | * {@inheritdoc} |
88 | 86 | */ |
89 | - public function create(string $path, string $content = '', int $mode = 0775) |
|
90 | - { |
|
87 | + public function create(string $path, string $content = '', int $mode = 0775) { |
|
91 | 88 | $file = $this->adapter->file($path)->write($content); |
92 | 89 | $file->chmod($mode); |
93 | 90 |
@@ -54,8 +54,7 @@ |
||
54 | 54 | * Class AdapterInterface |
55 | 55 | * @package Platine\Filesystem\Adapter |
56 | 56 | */ |
57 | -interface AdapterInterface |
|
58 | -{ |
|
57 | +interface AdapterInterface { |
|
59 | 58 | |
60 | 59 | /** |
61 | 60 | * Return the instance of file or directory |
@@ -54,8 +54,7 @@ discard block |
||
54 | 54 | * Class Filesystem |
55 | 55 | * @package Platine\Filesystem |
56 | 56 | */ |
57 | -class Filesystem |
|
58 | -{ |
|
57 | +class Filesystem { |
|
59 | 58 | |
60 | 59 | /** |
61 | 60 | * The adapter instance |
@@ -67,8 +66,7 @@ discard block |
||
67 | 66 | * Create new instance |
68 | 67 | * @param AdapterInterface|null $adapter |
69 | 68 | */ |
70 | - public function __construct(?AdapterInterface $adapter = null) |
|
71 | - { |
|
69 | + public function __construct(?AdapterInterface $adapter = null) { |
|
72 | 70 | $this->adapter = $adapter ?? new LocalAdapter(); |
73 | 71 | } |
74 | 72 | |
@@ -86,8 +84,7 @@ discard block |
||
86 | 84 | * @param string $path |
87 | 85 | * @return FileInterface|DirectoryInterface|null |
88 | 86 | */ |
89 | - public function get(string $path) |
|
90 | - { |
|
87 | + public function get(string $path) { |
|
91 | 88 | return $this->adapter->get($path); |
92 | 89 | } |
93 | 90 |
@@ -53,8 +53,7 @@ |
||
53 | 53 | * Class FilesystemInterface |
54 | 54 | * @package Platine\Filesystem |
55 | 55 | */ |
56 | -interface FilesystemInterface |
|
57 | -{ |
|
56 | +interface FilesystemInterface { |
|
58 | 57 | |
59 | 58 | /** |
60 | 59 | * Whether the file system is a file |
@@ -51,8 +51,7 @@ |
||
51 | 51 | * Class FileInterface |
52 | 52 | * @package Platine\Filesystem |
53 | 53 | */ |
54 | -interface FileInterface extends FilesystemInterface |
|
55 | -{ |
|
54 | +interface FileInterface extends FilesystemInterface { |
|
56 | 55 | |
57 | 56 | /** |
58 | 57 | * Create new file |
@@ -39,6 +39,5 @@ |
||
39 | 39 | * Class FilesystemException |
40 | 40 | * @package Platine\Filesystem\Adapter\Local\Exception |
41 | 41 | */ |
42 | -class FilesystemException extends Exception |
|
43 | -{ |
|
42 | +class FilesystemException extends Exception { |
|
44 | 43 | } |
@@ -37,6 +37,5 @@ |
||
37 | 37 | * Class NotFoundException |
38 | 38 | * @package Platine\Filesystem\Adapter\Local\Exception |
39 | 39 | */ |
40 | -class NotFoundException extends FilesystemException |
|
41 | -{ |
|
40 | +class NotFoundException extends FilesystemException { |
|
42 | 41 | } |
@@ -57,8 +57,7 @@ discard block |
||
57 | 57 | * Class AbstractLocal |
58 | 58 | * @package Platine\Filesystem\Adapter\Local |
59 | 59 | */ |
60 | -abstract class AbstractLocal implements FilesystemInterface |
|
61 | -{ |
|
60 | +abstract class AbstractLocal implements FilesystemInterface { |
|
62 | 61 | |
63 | 62 | /** |
64 | 63 | * The adapter instance |
@@ -83,8 +82,7 @@ discard block |
||
83 | 82 | * @param string $path |
84 | 83 | * @param AdapterInterface $adapter |
85 | 84 | */ |
86 | - public function __construct(string $path, AdapterInterface $adapter) |
|
87 | - { |
|
85 | + public function __construct(string $path, AdapterInterface $adapter) { |
|
88 | 86 | $this->adapter = $adapter; |
89 | 87 | $this->setPath($path); |
90 | 88 | } |
@@ -134,8 +132,7 @@ discard block |
||
134 | 132 | /** |
135 | 133 | * {@inheritdoc} |
136 | 134 | */ |
137 | - public function moveTo($directory) |
|
138 | - { |
|
135 | + public function moveTo($directory) { |
|
139 | 136 | $dest = $this->copyTo($directory); |
140 | 137 | $dest->touch($this->getMtime()); |
141 | 138 | $this->delete(); |
@@ -146,8 +143,7 @@ discard block |
||
146 | 143 | /** |
147 | 144 | * {@inheritdoc} |
148 | 145 | */ |
149 | - public function chmod(int $mode) |
|
150 | - { |
|
146 | + public function chmod(int $mode) { |
|
151 | 147 | chmod($this->path, $mode); |
152 | 148 | |
153 | 149 | return $this; |
@@ -245,8 +241,7 @@ discard block |
||
245 | 241 | /** |
246 | 242 | * {@inheritdoc} |
247 | 243 | */ |
248 | - public function rename(string $newPath) |
|
249 | - { |
|
244 | + public function rename(string $newPath) { |
|
250 | 245 | $normalizedNewPath = rtrim(Path::normalizePathDS($newPath), '\\/'); |
251 | 246 | if (strpos($normalizedNewPath, DIRECTORY_SEPARATOR) === false) { |
252 | 247 | $normalizedNewPath = dirname($this->originalPath) |
@@ -265,8 +260,7 @@ discard block |
||
265 | 260 | /** |
266 | 261 | * {@inheritdoc} |
267 | 262 | */ |
268 | - public function touch(int $time) |
|
269 | - { |
|
263 | + public function touch(int $time) { |
|
270 | 264 | touch($this->path, $time); |
271 | 265 | |
272 | 266 | return $this; |
@@ -56,14 +56,12 @@ discard block |
||
56 | 56 | * Class Directory |
57 | 57 | * @package Platine\Filesystem\Adapter\Local |
58 | 58 | */ |
59 | -class Directory extends AbstractLocal implements DirectoryInterface |
|
60 | -{ |
|
59 | +class Directory extends AbstractLocal implements DirectoryInterface { |
|
61 | 60 | |
62 | 61 | /** |
63 | 62 | * {@inheritdoc} |
64 | 63 | */ |
65 | - public function copyTo($directory, int $mode = 0775) |
|
66 | - { |
|
64 | + public function copyTo($directory, int $mode = 0775) { |
|
67 | 65 | if (!$this->exists()) { |
68 | 66 | throw new NotFoundException(sprintf( |
69 | 67 | 'Source path [%s] not found', |
@@ -97,8 +95,7 @@ discard block |
||
97 | 95 | /** |
98 | 96 | * {@inheritdoc} |
99 | 97 | */ |
100 | - public function create(string $name, int $mode = 0775, bool $recursive = false) |
|
101 | - { |
|
98 | + public function create(string $name, int $mode = 0775, bool $recursive = false) { |
|
102 | 99 | if (!file_exists($this->path . DIRECTORY_SEPARATOR . $name)) { |
103 | 100 | mkdir($this->path . DIRECTORY_SEPARATOR . $name, $mode, $recursive); |
104 | 101 | } else { |