@@ -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 | * Create new file |
| 58 | 57 | * @param string $path |
@@ -85,14 +85,14 @@ discard block |
||
| 85 | 85 | * @param int $mode the mode |
| 86 | 86 | * @return FileInterface|DirectoryInterface |
| 87 | 87 | */ |
| 88 | - public function copyTo(string|DirectoryInterface $directory, int $mode = 0775): FileInterface|DirectoryInterface; |
|
| 88 | + public function copyTo(string | DirectoryInterface $directory, int $mode = 0775): FileInterface | DirectoryInterface; |
|
| 89 | 89 | |
| 90 | 90 | /** |
| 91 | 91 | * Move this file system to new path |
| 92 | 92 | * @param string|DirectoryInterface $directory |
| 93 | 93 | * @return FileInterface|DirectoryInterface |
| 94 | 94 | */ |
| 95 | - public function moveTo(string|DirectoryInterface $directory): FileInterface|DirectoryInterface; |
|
| 95 | + public function moveTo(string | DirectoryInterface $directory): FileInterface | DirectoryInterface; |
|
| 96 | 96 | |
| 97 | 97 | /** |
| 98 | 98 | * Return the original path of this file system |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | * Delete the file system |
| 163 | 163 | * @return FileInterface|DirectoryInterface |
| 164 | 164 | */ |
| 165 | - public function delete(): FileInterface|DirectoryInterface; |
|
| 165 | + public function delete(): FileInterface | DirectoryInterface; |
|
| 166 | 166 | |
| 167 | 167 | /** |
| 168 | 168 | * Whether the file system is readable |
@@ -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 | * Whether the file system is a file |
| 60 | 59 | * @return bool |
@@ -85,7 +85,7 @@ |
||
| 85 | 85 | * @param string $path |
| 86 | 86 | * @return FileInterface|DirectoryInterface|null |
| 87 | 87 | */ |
| 88 | - public function get(string $path): FileInterface|DirectoryInterface|null |
|
| 88 | + public function get(string $path): FileInterface | DirectoryInterface | null |
|
| 89 | 89 | { |
| 90 | 90 | return $this->adapter->get($path); |
| 91 | 91 | } |
@@ -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 | * The adapter instance |
| 61 | 60 | * @var AdapterInterface |
@@ -66,8 +65,7 @@ discard block |
||
| 66 | 65 | * Create new instance |
| 67 | 66 | * @param AdapterInterface|null $adapter |
| 68 | 67 | */ |
| 69 | - public function __construct(?AdapterInterface $adapter = null) |
|
| 70 | - { |
|
| 68 | + public function __construct(?AdapterInterface $adapter = null) { |
|
| 71 | 69 | $this->adapter = $adapter ?? new LocalAdapter(); |
| 72 | 70 | } |
| 73 | 71 | |
@@ -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 | * Filter list for directory read |
| 58 | 57 | */ |
@@ -61,7 +61,7 @@ |
||
| 61 | 61 | * @param string $path |
| 62 | 62 | * @return FileInterface|DirectoryInterface|null |
| 63 | 63 | */ |
| 64 | - public function get(string $path): FileInterface|DirectoryInterface|null; |
|
| 64 | + public function get(string $path): FileInterface | DirectoryInterface | null; |
|
| 65 | 65 | |
| 66 | 66 | /** |
| 67 | 67 | * Return the instance of file |
@@ -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 | * Return the instance of file or directory |
| 61 | 60 | * @param string $path |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | /** |
| 136 | 136 | * {@inheritdoc} |
| 137 | 137 | */ |
| 138 | - public function moveTo(string|DirectoryInterface $directory): FileInterface|DirectoryInterface |
|
| 138 | + public function moveTo(string | DirectoryInterface $directory): FileInterface | DirectoryInterface |
|
| 139 | 139 | { |
| 140 | 140 | $dest = $this->copyTo($directory); |
| 141 | 141 | $dest->touch($this->getMtime()); |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | */ |
| 176 | 176 | public function getMtime(): int |
| 177 | 177 | { |
| 178 | - $time = filemtime($this->path); |
|
| 178 | + $time = filemtime($this->path); |
|
| 179 | 179 | return $time !== false ? $time : -1; |
| 180 | 180 | } |
| 181 | 181 | |
@@ -59,8 +59,7 @@ discard block |
||
| 59 | 59 | * @class AbstractLocal |
| 60 | 60 | * @package Platine\Filesystem\Adapter\Local |
| 61 | 61 | */ |
| 62 | -abstract class AbstractLocal implements FilesystemInterface |
|
| 63 | -{ |
|
| 62 | +abstract class AbstractLocal implements FilesystemInterface { |
|
| 64 | 63 | /** |
| 65 | 64 | * The adapter instance |
| 66 | 65 | * @var AdapterInterface |
@@ -84,8 +83,7 @@ discard block |
||
| 84 | 83 | * @param string $path |
| 85 | 84 | * @param AdapterInterface $adapter |
| 86 | 85 | */ |
| 87 | - public function __construct(string $path, AdapterInterface $adapter) |
|
| 88 | - { |
|
| 86 | + public function __construct(string $path, AdapterInterface $adapter) { |
|
| 89 | 87 | $this->adapter = $adapter; |
| 90 | 88 | $this->setPath($path); |
| 91 | 89 | } |
@@ -62,9 +62,9 @@ |
||
| 62 | 62 | * {@inheritdoc} |
| 63 | 63 | */ |
| 64 | 64 | public function copyTo( |
| 65 | - string|DirectoryInterface $directory, |
|
| 65 | + string | DirectoryInterface $directory, |
|
| 66 | 66 | int $mode = 0775 |
| 67 | - ): FileInterface|DirectoryInterface { |
|
| 67 | + ): FileInterface | DirectoryInterface { |
|
| 68 | 68 | if (!$this->exists()) { |
| 69 | 69 | throw new NotFoundException(sprintf( |
| 70 | 70 | 'Source path [%s] not found', |
@@ -56,8 +56,7 @@ |
||
| 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 | * {@inheritdoc} |
| 63 | 62 | */ |
@@ -105,7 +105,7 @@ |
||
| 105 | 105 | /** |
| 106 | 106 | * {@inheritdoc} |
| 107 | 107 | */ |
| 108 | - public function get(string $path): FileInterface|DirectoryInterface|null |
|
| 108 | + public function get(string $path): FileInterface | DirectoryInterface | null |
|
| 109 | 109 | { |
| 110 | 110 | $absolutePath = $this->getAbsolutePath($path); |
| 111 | 111 | |
@@ -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 | * The root directory |
| 64 | 63 | * @var string |
@@ -69,8 +68,7 @@ discard block |
||
| 69 | 68 | * Create new instance |
| 70 | 69 | * @param string $root |
| 71 | 70 | */ |
| 72 | - public function __construct(string $root = '') |
|
| 73 | - { |
|
| 71 | + public function __construct(string $root = '') { |
|
| 74 | 72 | if ($root !== '') { |
| 75 | 73 | $root = Path::normalizePathDS($root, true); |
| 76 | 74 | |
@@ -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 | } |