@@ -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 |
@@ -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 | * Upload Storage |
| 73 | 72 | * @var StorageInterface |
@@ -248,8 +247,7 @@ discard block |
||
| 248 | 247 | * Return the uploaded file information |
| 249 | 248 | * @return UploadFileInfo|array<int, UploadFileInfo>|bool |
| 250 | 249 | */ |
| 251 | - public function getInfo() |
|
| 252 | - { |
|
| 250 | + public function getInfo() { |
|
| 253 | 251 | return $this->uploadInfo; |
| 254 | 252 | } |
| 255 | 253 | |
@@ -146,8 +146,8 @@ |
||
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | /** |
| 149 | - * Whether the file is uploaded |
|
| 150 | - */ |
|
| 149 | + * Whether the file is uploaded |
|
| 150 | + */ |
|
| 151 | 151 | public function isUploaded(): bool |
| 152 | 152 | { |
| 153 | 153 | return count($this->files) > 0; |
@@ -60,8 +60,7 @@ discard block |
||
| 60 | 60 | * Class Extension |
| 61 | 61 | * @package Platine\Upload\Validator\Rule |
| 62 | 62 | */ |
| 63 | -class Extension implements RuleInterface |
|
| 64 | -{ |
|
| 63 | +class Extension implements RuleInterface { |
|
| 65 | 64 | /** |
| 66 | 65 | * The list of allowed/forbidden extensions |
| 67 | 66 | * @var array<int, string> |
@@ -79,8 +78,7 @@ discard block |
||
| 79 | 78 | * @param array<int, string>|string $extensions |
| 80 | 79 | * @param bool $exclude |
| 81 | 80 | */ |
| 82 | - public function __construct($extensions, bool $exclude = false) |
|
| 83 | - { |
|
| 81 | + public function __construct($extensions, bool $exclude = false) { |
|
| 84 | 82 | if (!is_array($extensions)) { |
| 85 | 83 | $extensions = [$extensions]; |
| 86 | 84 | } |