@@ -32,22 +32,19 @@ |
||
32 | 32 | 'Width is required when you are in SCALE_HEIGHT mode' |
33 | 33 | ); |
34 | 34 | } |
35 | - } |
|
36 | - else if ($this->mode === LaruploadMediaStyle::SCALE_WIDTH) { |
|
35 | + } else if ($this->mode === LaruploadMediaStyle::SCALE_WIDTH) { |
|
37 | 36 | if ($this->height === null or $this->height === 0) { |
38 | 37 | throw new Exception( |
39 | 38 | 'Height is required when you are in SCALE_WIDTH mode' |
40 | 39 | ); |
41 | 40 | } |
42 | - } |
|
43 | - else if (in_array($this->mode, [LaruploadMediaStyle::CROP, LaruploadMediaStyle::FIT])) { |
|
41 | + } else if (in_array($this->mode, [LaruploadMediaStyle::CROP, LaruploadMediaStyle::FIT])) { |
|
44 | 42 | if (!$this->width or !$this->height) { |
45 | 43 | throw new Exception( |
46 | 44 | 'Width and Height are required when you are in CROP/FIT mode' |
47 | 45 | ); |
48 | 46 | } |
49 | - } |
|
50 | - else if ($this->mode === LaruploadMediaStyle::AUTO) { |
|
47 | + } else if ($this->mode === LaruploadMediaStyle::AUTO) { |
|
51 | 48 | if (!$this->width and !$this->height) { |
52 | 49 | throw new Exception( |
53 | 50 | 'Width and height are required when you are in auto mode' |
@@ -17,8 +17,7 @@ discard block |
||
17 | 17 | if (isset($this->file)) { |
18 | 18 | if ($this->file == LARUPLOAD_NULL) { |
19 | 19 | $this->clean($this->id); |
20 | - } |
|
21 | - else { |
|
20 | + } else { |
|
22 | 21 | if (!$this->keepOldFiles) { |
23 | 22 | $this->clean($this->id); |
24 | 23 | } |
@@ -31,8 +30,7 @@ discard block |
||
31 | 30 | } |
32 | 31 | |
33 | 32 | $model = $this->setAttributes($model); |
34 | - } |
|
35 | - else if (isset($this->cover)) { |
|
33 | + } else if (isset($this->cover)) { |
|
36 | 34 | $this->setCover($this->id); |
37 | 35 | |
38 | 36 | $model = $this->setAttributes($model); |
@@ -50,8 +50,7 @@ |
||
50 | 50 | if ($style == Larupload::COVER_FOLDER and !$this->generateCover) { |
51 | 51 | $styles->{$style} = null; |
52 | 52 | continue; |
53 | - } |
|
54 | - else if ($style == Larupload::STREAM_FOLDER and empty($this->streams)) { |
|
53 | + } else if ($style == Larupload::STREAM_FOLDER and empty($this->streams)) { |
|
55 | 54 | unset($styles->{$style}); |
56 | 55 | continue; |
57 | 56 | } |
@@ -361,8 +361,7 @@ |
||
361 | 361 | foreach ($this->output as $key => $value) { |
362 | 362 | $this->output[$key] = $model->{"{$this->name}_file_$key"}; |
363 | 363 | } |
364 | - } |
|
365 | - else { |
|
364 | + } else { |
|
366 | 365 | $meta = json_decode($model->{"{$this->name}_file_meta"}, true); |
367 | 366 | |
368 | 367 | if (is_array($meta)) { |
@@ -20,8 +20,7 @@ discard block |
||
20 | 20 | { |
21 | 21 | if ($attachment = $this->getAttachment($key)) { |
22 | 22 | $attachment->attach($value); |
23 | - } |
|
24 | - else { |
|
23 | + } else { |
|
25 | 24 | parent::setAttribute($key, $value); |
26 | 25 | } |
27 | 26 | } |
@@ -55,8 +54,7 @@ discard block |
||
55 | 54 | } |
56 | 55 | |
57 | 56 | return null; |
58 | - } |
|
59 | - else { |
|
57 | + } else { |
|
60 | 58 | $attachments = new stdClass(); |
61 | 59 | |
62 | 60 | foreach ($this->attachments as $attachment) { |
@@ -139,8 +137,7 @@ discard block |
||
139 | 137 | unset($array["{$name}_file_dominant_color"]); |
140 | 138 | unset($array["{$name}_file_format"]); |
141 | 139 | unset($array["{$name}_file_cover"]); |
142 | - } |
|
143 | - else { |
|
140 | + } else { |
|
144 | 141 | unset($array["{$name}_file_meta"]); |
145 | 142 | } |
146 | 143 | } |
@@ -49,8 +49,7 @@ |
||
49 | 49 | { |
50 | 50 | if ($this->internalFunctionIsCallable) { |
51 | 51 | parent::handleFFMpegQueue($isLastOne, $standalone); |
52 | - } |
|
53 | - else { |
|
52 | + } else { |
|
54 | 53 | $this->internalException(); |
55 | 54 | } |
56 | 55 | } |
@@ -118,8 +118,7 @@ |
||
118 | 118 | |
119 | 119 | if ($this->driverIsLocal) { |
120 | 120 | File::makeDirectory($directory); |
121 | - } |
|
122 | - else { |
|
121 | + } else { |
|
123 | 122 | @mkdir( |
124 | 123 | directory: $directory, |
125 | 124 | recursive: true |
@@ -147,8 +147,7 @@ discard block |
||
147 | 147 | |
148 | 148 | if ($style->padding) { |
149 | 149 | $this->media->filters()->pad($dimension)->synchronize(); |
150 | - } |
|
151 | - else { |
|
150 | + } else { |
|
152 | 151 | $mode = $style->mode->ffmpegResizeFilter() ?? ResizeFilter::RESIZEMODE_SCALE_HEIGHT; |
153 | 152 | |
154 | 153 | $this->media->filters() |
@@ -167,8 +166,7 @@ discard block |
||
167 | 166 | |
168 | 167 | if ($width and $height) { |
169 | 168 | $this->media->filters()->custom("scale=$scaleType,crop=$width:$height,setsar=1"); |
170 | - } |
|
171 | - else { |
|
169 | + } else { |
|
172 | 170 | /** |
173 | 171 | * With new validation rules in Video/Image/Stream style, this code will never happen |
174 | 172 | */ |
@@ -201,8 +199,7 @@ discard block |
||
201 | 199 | |
202 | 200 | try { |
203 | 201 | $this->media->getFFMpegDriver()->command($commands); |
204 | - } |
|
205 | - catch (ExecutionFailureException $e) { |
|
202 | + } catch (ExecutionFailureException $e) { |
|
206 | 203 | if (file_exists($saveToPath) && is_writable($saveToPath)) { |
207 | 204 | // @codeCoverageIgnoreStart |
208 | 205 | @unlink($saveToPath); |
@@ -35,17 +35,13 @@ |
||
35 | 35 | { |
36 | 36 | if (str_contains($mime, 'image/')) { |
37 | 37 | return LaruploadFileType::IMAGE; |
38 | - } |
|
39 | - else if (str_contains($mime, 'video/')) { |
|
38 | + } else if (str_contains($mime, 'video/')) { |
|
40 | 39 | return LaruploadFileType::VIDEO; |
41 | - } |
|
42 | - else if (str_contains($mime, 'audio/')) { |
|
40 | + } else if (str_contains($mime, 'audio/')) { |
|
43 | 41 | return LaruploadFileType::AUDIO; |
44 | - } |
|
45 | - else if ($this->isDocument($mime)) { |
|
42 | + } else if ($this->isDocument($mime)) { |
|
46 | 43 | return LaruploadFileType::DOCUMENT; |
47 | - } |
|
48 | - else if ($this->isCompressed($mime)) { |
|
44 | + } else if ($this->isCompressed($mime)) { |
|
49 | 45 | return LaruploadFileType::COMPRESSED; |
50 | 46 | } |
51 | 47 |