@@ -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 ? $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 |
@@ -51,8 +51,7 @@ |
||
51 | 51 | * Class Helper |
52 | 52 | * @package Platine\Filesystem\Util |
53 | 53 | */ |
54 | -class Helper |
|
55 | -{ |
|
54 | +class Helper { |
|
56 | 55 | |
57 | 56 | /** |
58 | 57 | * List of mime type |
@@ -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 |
@@ -51,8 +51,7 @@ |
||
51 | 51 | * Class DirectoryInterface |
52 | 52 | * @package Platine\Filesystem |
53 | 53 | */ |
54 | -interface DirectoryInterface extends FileSystemInterface |
|
55 | -{ |
|
54 | +interface DirectoryInterface extends FileSystemInterface { |
|
56 | 55 | |
57 | 56 | /** |
58 | 57 | * Filter list for directory read |
@@ -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 |
@@ -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) |
|
101 | - { |
|
98 | + public function create(string $name, int $mode = 0775) { |
|
102 | 99 | if (!file_exists($this->path . DIRECTORY_SEPARATOR . $name)) { |
103 | 100 | mkdir($this->path . DIRECTORY_SEPARATOR . $name, $mode); |
104 | 101 | } else { |
@@ -57,8 +57,7 @@ discard block |
||
57 | 57 | * Class LocalAdpater |
58 | 58 | * @package Platine\Filesystem\Adapter\Local |
59 | 59 | */ |
60 | -class LocalAdapter implements AdapterInterface |
|
61 | -{ |
|
60 | +class LocalAdapter implements AdapterInterface { |
|
62 | 61 | |
63 | 62 | /** |
64 | 63 | * The root directory |
@@ -70,8 +69,7 @@ discard block |
||
70 | 69 | * Create new instance |
71 | 70 | * @param string|null $root |
72 | 71 | */ |
73 | - public function __construct(?string $root = null) |
|
74 | - { |
|
72 | + public function __construct(?string $root = null) { |
|
75 | 73 | if ($root === null) { |
76 | 74 | $path = realpath(__DIR__ . '../../../../../'); |
77 | 75 | if ($path !== false) { |
@@ -113,8 +111,7 @@ discard block |
||
113 | 111 | /** |
114 | 112 | * {@inheritdoc} |
115 | 113 | */ |
116 | - public function get(string $path) |
|
117 | - { |
|
114 | + public function get(string $path) { |
|
118 | 115 | $absolutePath = $this->getAbsolutePath($path); |
119 | 116 | |
120 | 117 | if (is_file($absolutePath)) { |
@@ -39,6 +39,5 @@ |
||
39 | 39 | * Class NotFoundException |
40 | 40 | * @package Platine\Filesystem\Adapter\Local\Exception |
41 | 41 | */ |
42 | -class NotFoundException extends Exception |
|
43 | -{ |
|
42 | +class NotFoundException extends Exception { |
|
44 | 43 | } |
@@ -55,8 +55,7 @@ discard block |
||
55 | 55 | * Class AbstractLocal |
56 | 56 | * @package Platine\Filesystem\Adapter\Local |
57 | 57 | */ |
58 | -abstract class AbstractLocal implements FileSystemInterface |
|
59 | -{ |
|
58 | +abstract class AbstractLocal implements FileSystemInterface { |
|
60 | 59 | |
61 | 60 | /** |
62 | 61 | * The adapter instance |
@@ -81,8 +80,7 @@ discard block |
||
81 | 80 | * @param string $path |
82 | 81 | * @param AdapterInterface $adapter |
83 | 82 | */ |
84 | - public function __construct(string $path, AdapterInterface $adapter) |
|
85 | - { |
|
83 | + public function __construct(string $path, AdapterInterface $adapter) { |
|
86 | 84 | $this->adapter = $adapter; |
87 | 85 | $this->setPath($path); |
88 | 86 | } |
@@ -132,8 +130,7 @@ discard block |
||
132 | 130 | /** |
133 | 131 | * {@inheritdoc} |
134 | 132 | */ |
135 | - public function moveTo($directory) |
|
136 | - { |
|
133 | + public function moveTo($directory) { |
|
137 | 134 | $dest = $this->copyTo($directory); |
138 | 135 | $dest->touch($this->getMtime()); |
139 | 136 | $this->delete(); |
@@ -144,8 +141,7 @@ discard block |
||
144 | 141 | /** |
145 | 142 | * {@inheritdoc} |
146 | 143 | */ |
147 | - public function chmod(int $mode) |
|
148 | - { |
|
144 | + public function chmod(int $mode) { |
|
149 | 145 | chmod($this->path, $mode); |
150 | 146 | |
151 | 147 | return $this; |
@@ -240,8 +236,7 @@ discard block |
||
240 | 236 | /** |
241 | 237 | * {@inheritdoc} |
242 | 238 | */ |
243 | - public function rename(string $newPath) |
|
244 | - { |
|
239 | + public function rename(string $newPath) { |
|
245 | 240 | $normalizedNewPath = rtrim(Helper::normalizePath($newPath), '\\/'); |
246 | 241 | if (strpos($normalizedNewPath, DIRECTORY_SEPARATOR) === false) { |
247 | 242 | $normalizedNewPath = dirname($this->originalPath) |
@@ -260,8 +255,7 @@ discard block |
||
260 | 255 | /** |
261 | 256 | * {@inheritdoc} |
262 | 257 | */ |
263 | - public function touch(int $time) |
|
264 | - { |
|
258 | + public function touch(int $time) { |
|
265 | 259 | touch($this->path, $time); |
266 | 260 | |
267 | 261 | return $this; |