@@ -62,8 +62,7 @@ discard block |
||
| 62 | 62 | * Class FileSystem |
| 63 | 63 | * @package Platine\Upload\Storage |
| 64 | 64 | */ |
| 65 | -class FileSystem implements StorageInterface |
|
| 66 | -{ |
|
| 65 | +class FileSystem implements StorageInterface { |
|
| 67 | 66 | /** |
| 68 | 67 | * Path to move uploaded files |
| 69 | 68 | * @var string |
@@ -81,8 +80,7 @@ discard block |
||
| 81 | 80 | * @param string $path |
| 82 | 81 | * @param bool $overwrite |
| 83 | 82 | */ |
| 84 | - public function __construct(string $path, bool $overwrite) |
|
| 85 | - { |
|
| 83 | + public function __construct(string $path, bool $overwrite) { |
|
| 86 | 84 | $this->overwrite = $overwrite; |
| 87 | 85 | $directory = $this->normalizePath($path); |
| 88 | 86 | |
@@ -59,8 +59,7 @@ |
||
| 59 | 59 | * Class StorageInterface |
| 60 | 60 | * @package Platine\Upload\Storage |
| 61 | 61 | */ |
| 62 | -interface StorageInterface |
|
| 63 | -{ |
|
| 62 | +interface StorageInterface { |
|
| 64 | 63 | /** |
| 65 | 64 | * Move the uploaded file to destination |
| 66 | 65 | * @param File $file |
@@ -147,12 +147,12 @@ |
||
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | /** |
| 150 | - * Whether the file is uploaded |
|
| 151 | - */ |
|
| 150 | + * Whether the file is uploaded |
|
| 151 | + */ |
|
| 152 | 152 | public function isUploaded(): bool |
| 153 | 153 | { |
| 154 | 154 | return count($this->files) > 0 |
| 155 | - && $this->files[0]->getMimeType() !== 'application/x-empty'; |
|
| 155 | + && $this->files[0]->getMimeType() !== 'application/x-empty'; |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | /** |
@@ -125,7 +125,7 @@ |
||
| 125 | 125 | $this->storage = $storage; |
| 126 | 126 | $this->validator = $validator ? $validator : new Validator(); |
| 127 | 127 | |
| 128 | - if(empty($uploadedFiles)){ |
|
| 128 | + if (empty($uploadedFiles)) { |
|
| 129 | 129 | $uploadedFiles = UploadedFile::createFromGlobals(); |
| 130 | 130 | } |
| 131 | 131 | |
@@ -66,8 +66,7 @@ discard block |
||
| 66 | 66 | * Class Upload |
| 67 | 67 | * @package Platine\Upload |
| 68 | 68 | */ |
| 69 | -class Upload |
|
| 70 | -{ |
|
| 69 | +class Upload { |
|
| 71 | 70 | |
| 72 | 71 | /** |
| 73 | 72 | * Upload Storage |
@@ -125,7 +124,7 @@ discard block |
||
| 125 | 124 | $this->storage = $storage; |
| 126 | 125 | $this->validator = $validator ? $validator : new Validator(); |
| 127 | 126 | |
| 128 | - if(empty($uploadedFiles)){ |
|
| 127 | + if(empty($uploadedFiles)) { |
|
| 129 | 128 | $uploadedFiles = UploadedFile::createFromGlobals(); |
| 130 | 129 | } |
| 131 | 130 | |
@@ -246,8 +245,7 @@ discard block |
||
| 246 | 245 | * Return the uploaded file information |
| 247 | 246 | * @return UploadFileInfo|array<int, UploadFileInfo>|bool |
| 248 | 247 | */ |
| 249 | - public function getInfo() |
|
| 250 | - { |
|
| 248 | + public function getInfo() { |
|
| 251 | 249 | return $this->uploadInfo; |
| 252 | 250 | } |
| 253 | 251 | |
@@ -58,8 +58,7 @@ |
||
| 58 | 58 | * Class RuleInterface |
| 59 | 59 | * @package Platine\Upload\Validator |
| 60 | 60 | */ |
| 61 | -interface RuleInterface |
|
| 62 | -{ |
|
| 61 | +interface RuleInterface { |
|
| 63 | 62 | /** |
| 64 | 63 | * Method to validate this Rule |
| 65 | 64 | * |
@@ -58,8 +58,7 @@ discard block |
||
| 58 | 58 | * Class Validator |
| 59 | 59 | * @package Platine\Upload\Validator |
| 60 | 60 | */ |
| 61 | -class Validator |
|
| 62 | -{ |
|
| 61 | +class Validator { |
|
| 63 | 62 | /** |
| 64 | 63 | * The validate rules |
| 65 | 64 | * @var array<int, RuleInterface> |
@@ -70,8 +69,7 @@ discard block |
||
| 70 | 69 | * Create new instance |
| 71 | 70 | * @param array<int, RuleInterface> $rules |
| 72 | 71 | */ |
| 73 | - public function __construct(array $rules = []) |
|
| 74 | - { |
|
| 72 | + public function __construct(array $rules = []) { |
|
| 75 | 73 | $this->rules = $rules; |
| 76 | 74 | } |
| 77 | 75 | |
@@ -60,8 +60,7 @@ discard block |
||
| 60 | 60 | * Class Size |
| 61 | 61 | * @package Platine\Upload\Validator\Rule |
| 62 | 62 | */ |
| 63 | -class Size implements RuleInterface |
|
| 64 | -{ |
|
| 63 | +class Size implements RuleInterface { |
|
| 65 | 64 | /** |
| 66 | 65 | * The uploaded file max size |
| 67 | 66 | * @var int |
@@ -72,8 +71,7 @@ discard block |
||
| 72 | 71 | * Create new instance |
| 73 | 72 | * @param int|string $size |
| 74 | 73 | */ |
| 75 | - public function __construct($size) |
|
| 76 | - { |
|
| 74 | + public function __construct($size) { |
|
| 77 | 75 | if (!is_int($size)) { |
| 78 | 76 | $size = Helper::sizeInBytes($size); |
| 79 | 77 | } |
@@ -60,8 +60,7 @@ discard block |
||
| 60 | 60 | * Class MimeType |
| 61 | 61 | * @package Platine\Upload\Validator\Rule |
| 62 | 62 | */ |
| 63 | -class MimeType implements RuleInterface |
|
| 64 | -{ |
|
| 63 | +class MimeType implements RuleInterface { |
|
| 65 | 64 | /** |
| 66 | 65 | * The list of allowed uploaded file mime type |
| 67 | 66 | * @var array<int, string> |
@@ -72,8 +71,7 @@ discard block |
||
| 72 | 71 | * Create new instance |
| 73 | 72 | * @param array<int, string>|string $mimeType |
| 74 | 73 | */ |
| 75 | - public function __construct($mimeType) |
|
| 76 | - { |
|
| 74 | + public function __construct($mimeType) { |
|
| 77 | 75 | if (!is_array($mimeType)) { |
| 78 | 76 | $mimeType = [$mimeType]; |
| 79 | 77 | } |
@@ -56,8 +56,7 @@ |
||
| 56 | 56 | * Class FileInterface |
| 57 | 57 | * @package Platine\Upload\File |
| 58 | 58 | */ |
| 59 | -interface FileInterface |
|
| 60 | -{ |
|
| 59 | +interface FileInterface { |
|
| 61 | 60 | /** |
| 62 | 61 | * Return the path name of uploaded file |
| 63 | 62 | * @return string |