@@ -40,6 +40,5 @@ |
||
| 40 | 40 | * Class UploadException |
| 41 | 41 | * @package Platine\Upload\Exception |
| 42 | 42 | */ |
| 43 | -class UploadException extends RuntimeException |
|
| 44 | -{ |
|
| 43 | +class UploadException extends RuntimeException { |
|
| 45 | 44 | } |
@@ -40,6 +40,5 @@ |
||
| 40 | 40 | * Class StorageException |
| 41 | 41 | * @package Platine\Upload\Exception |
| 42 | 42 | */ |
| 43 | -class StorageException extends RuntimeException |
|
| 44 | -{ |
|
| 43 | +class StorageException extends RuntimeException { |
|
| 45 | 44 | } |
@@ -62,8 +62,7 @@ discard block |
||
| 62 | 62 | * Class Upload |
| 63 | 63 | * @package Platine\Upload |
| 64 | 64 | */ |
| 65 | -class Upload |
|
| 66 | -{ |
|
| 65 | +class Upload { |
|
| 67 | 66 | |
| 68 | 67 | /** |
| 69 | 68 | * Upload Storage |
@@ -232,8 +231,7 @@ discard block |
||
| 232 | 231 | * Return the uploaded file information |
| 233 | 232 | * @return UploadFileInfo|array<int, UploadFileInfo>|bool |
| 234 | 233 | */ |
| 235 | - public function getInfo() |
|
| 236 | - { |
|
| 234 | + public function getInfo() { |
|
| 237 | 235 | return $this->uploadInfo; |
| 238 | 236 | } |
| 239 | 237 | |
@@ -112,16 +112,16 @@ discard block |
||
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | /** |
| 115 | - * {@inheritdoc} |
|
| 116 | - */ |
|
| 115 | + * {@inheritdoc} |
|
| 116 | + */ |
|
| 117 | 117 | public function getExtension(): string |
| 118 | 118 | { |
| 119 | 119 | return $this->extension; |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | /** |
| 123 | - * {@inheritdoc} |
|
| 124 | - */ |
|
| 123 | + * {@inheritdoc} |
|
| 124 | + */ |
|
| 125 | 125 | public function setExtension(string $name): self |
| 126 | 126 | { |
| 127 | 127 | $this->extension = strtolower($name); |
@@ -130,8 +130,8 @@ discard block |
||
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | /** |
| 133 | - * {@inheritdoc} |
|
| 134 | - */ |
|
| 133 | + * {@inheritdoc} |
|
| 134 | + */ |
|
| 135 | 135 | public function getFullName(): string |
| 136 | 136 | { |
| 137 | 137 | return $this->extension === '' ? |
@@ -140,8 +140,8 @@ discard block |
||
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | /** |
| 143 | - * {@inheritdoc} |
|
| 144 | - */ |
|
| 143 | + * {@inheritdoc} |
|
| 144 | + */ |
|
| 145 | 145 | public function getMD5(): string |
| 146 | 146 | { |
| 147 | 147 | $hash = md5_file($this->getPathname()); |
@@ -149,24 +149,24 @@ discard block |
||
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | /** |
| 152 | - * {@inheritdoc} |
|
| 153 | - */ |
|
| 152 | + * {@inheritdoc} |
|
| 153 | + */ |
|
| 154 | 154 | public function getPathname(): string |
| 155 | 155 | { |
| 156 | 156 | return parent::getPathname(); |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | /** |
| 160 | - * {@inheritdoc} |
|
| 161 | - */ |
|
| 160 | + * {@inheritdoc} |
|
| 161 | + */ |
|
| 162 | 162 | public function getSize(): int |
| 163 | 163 | { |
| 164 | 164 | return parent::getSize(); |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | /** |
| 168 | - * {@inheritdoc} |
|
| 169 | - */ |
|
| 168 | + * {@inheritdoc} |
|
| 169 | + */ |
|
| 170 | 170 | public function getMimeType(): string |
| 171 | 171 | { |
| 172 | 172 | if (empty($this->mimeType)) { |
@@ -185,16 +185,16 @@ discard block |
||
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | /** |
| 188 | - * {@inheritdoc} |
|
| 189 | - */ |
|
| 188 | + * {@inheritdoc} |
|
| 189 | + */ |
|
| 190 | 190 | public function getName(): string |
| 191 | 191 | { |
| 192 | 192 | return $this->name; |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | /** |
| 196 | - * {@inheritdoc} |
|
| 197 | - */ |
|
| 196 | + * {@inheritdoc} |
|
| 197 | + */ |
|
| 198 | 198 | public function setName(string $name): self |
| 199 | 199 | { |
| 200 | 200 | $cleanName = preg_replace('/[^A-Za-z0-9\.]+/', '_', $name); |
@@ -207,8 +207,8 @@ discard block |
||
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | /** |
| 210 | - * {@inheritdoc} |
|
| 211 | - */ |
|
| 210 | + * {@inheritdoc} |
|
| 211 | + */ |
|
| 212 | 212 | public function getError(): int |
| 213 | 213 | { |
| 214 | 214 | return $this->error; |
@@ -61,8 +61,7 @@ |
||
| 61 | 61 | * Class File |
| 62 | 62 | * @package Platine\Upload\File |
| 63 | 63 | */ |
| 64 | -class File extends SplFileInfo implements FileInterface |
|
| 65 | -{ |
|
| 64 | +class File extends SplFileInfo implements FileInterface { |
|
| 66 | 65 | /** |
| 67 | 66 | * Factory used to create new instance |
| 68 | 67 | * @var callable|null |
@@ -52,8 +52,7 @@ |
||
| 52 | 52 | * Class FileInterface |
| 53 | 53 | * @package Platine\Upload\File |
| 54 | 54 | */ |
| 55 | -interface FileInterface |
|
| 56 | -{ |
|
| 55 | +interface FileInterface { |
|
| 57 | 56 | |
| 58 | 57 | /** |
| 59 | 58 | * Return the path name of uploaded file |
@@ -52,8 +52,7 @@ |
||
| 52 | 52 | * Class UploadFileInfo |
| 53 | 53 | * @package Platine\Upload\File |
| 54 | 54 | */ |
| 55 | -class UploadFileInfo |
|
| 56 | -{ |
|
| 55 | +class UploadFileInfo { |
|
| 57 | 56 | /** |
| 58 | 57 | * The full file name |
| 59 | 58 | * @var string |
@@ -126,7 +126,7 @@ |
||
| 126 | 126 | if (array_key_exists('unit', $matches)) { |
| 127 | 127 | $unit = strtoupper($matches['unit']); |
| 128 | 128 | } |
| 129 | - return (int)(floatval($matches['size']) * pow(1024, $units[$unit])); |
|
| 129 | + return (int) (floatval($matches['size']) * pow(1024, $units[$unit])); |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | /** |
@@ -55,8 +55,7 @@ |
||
| 55 | 55 | * Class Helper |
| 56 | 56 | * @package Platine\Upload\Util |
| 57 | 57 | */ |
| 58 | -class Helper |
|
| 59 | -{ |
|
| 58 | +class Helper { |
|
| 60 | 59 | /** |
| 61 | 60 | * Normalize the uploaded files to fit our format |
| 62 | 61 | * |
@@ -55,8 +55,7 @@ |
||
| 55 | 55 | * Class UploadError |
| 56 | 56 | * @package Platine\Upload\Validator\Rule |
| 57 | 57 | */ |
| 58 | -class UploadError implements RuleInterface |
|
| 59 | -{ |
|
| 58 | +class UploadError implements RuleInterface { |
|
| 60 | 59 | /** |
| 61 | 60 | * {@inheritdoc} |
| 62 | 61 | * @see RuleInterface |
@@ -56,8 +56,7 @@ discard block |
||
| 56 | 56 | * Class Size |
| 57 | 57 | * @package Platine\Upload\Validator\Rule |
| 58 | 58 | */ |
| 59 | -class Size implements RuleInterface |
|
| 60 | -{ |
|
| 59 | +class Size implements RuleInterface { |
|
| 61 | 60 | |
| 62 | 61 | /** |
| 63 | 62 | * The uploaded file max size |
@@ -69,8 +68,7 @@ discard block |
||
| 69 | 68 | * Create new instance |
| 70 | 69 | * @param int|string $size |
| 71 | 70 | */ |
| 72 | - public function __construct($size) |
|
| 73 | - { |
|
| 71 | + public function __construct($size) { |
|
| 74 | 72 | if (!is_int($size)) { |
| 75 | 73 | $size = Helper::sizeInBytes($size); |
| 76 | 74 | } |