@@ -60,25 +60,20 @@ discard block |
||
60 | 60 | |
61 | 61 | if ($style->mode === LaruploadMediaStyle::SCALE_HEIGHT and $style->width) { |
62 | 62 | $this->resizeLandscape($style->width); |
63 | - } |
|
64 | - else if ($style->mode == LaruploadMediaStyle::SCALE_WIDTH and $style->height) { |
|
63 | + } else if ($style->mode == LaruploadMediaStyle::SCALE_WIDTH and $style->height) { |
|
65 | 64 | $this->resizePortrait($style->height); |
66 | - } |
|
67 | - else if ($style->mode == LaruploadMediaStyle::CROP and $style->height and $style->width) { |
|
65 | + } else if ($style->mode == LaruploadMediaStyle::CROP and $style->height and $style->width) { |
|
68 | 66 | $this->resizeCrop($style->width, $style->height); |
69 | - } |
|
70 | - else if ($style->mode == LaruploadMediaStyle::FIT and $style->height and $style->width) { |
|
67 | + } else if ($style->mode == LaruploadMediaStyle::FIT and $style->height and $style->width) { |
|
71 | 68 | $this->resizeExact($style->width, $style->height); |
72 | - } |
|
73 | - else { |
|
69 | + } else { |
|
74 | 70 | $this->resizeAuto($style->width, $style->height); |
75 | 71 | } |
76 | 72 | |
77 | 73 | |
78 | 74 | if ($this->driverIsLocal) { |
79 | 75 | $this->image->save($saveTo); |
80 | - } |
|
81 | - else { |
|
76 | + } else { |
|
82 | 77 | list($path, $name) = split_larupload_path($saveTo); |
83 | 78 | |
84 | 79 | $tempDir = larupload_temp_dir(); |
@@ -109,8 +104,7 @@ discard block |
||
109 | 104 | |
110 | 105 | if ($file instanceof UploadedFile) { |
111 | 106 | $path = $file->getRealPath(); |
112 | - } |
|
113 | - else if (file_exists($file)) { |
|
107 | + } else if (file_exists($file)) { |
|
114 | 108 | $path = $file; |
115 | 109 | } |
116 | 110 |
@@ -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 |
@@ -29,11 +29,9 @@ |
||
29 | 29 | |
30 | 30 | if ($this->shouldDeleteCover()) { |
31 | 31 | $output = DeleteCoverAction::make($this->data->type, $output)->run(); |
32 | - } |
|
33 | - else if ($this->shouldUploadCover()) { |
|
32 | + } else if ($this->shouldUploadCover()) { |
|
34 | 33 | $output = UploadCoverAction::make($this->cover, $this->data)->run($path); |
35 | - } |
|
36 | - else if ($this->data->generateCover) { |
|
34 | + } else if ($this->data->generateCover) { |
|
37 | 35 | $output = GenerateCoverFromFileAction::make($this->file, $this->data)->run($path); |
38 | 36 | } |
39 | 37 |
@@ -37,8 +37,7 @@ discard block |
||
37 | 37 | // @codeCoverageIgnoreStart |
38 | 38 | if (ini_get('upload_tmp_dir')) { |
39 | 39 | $path = ini_get('upload_tmp_dir'); |
40 | - } |
|
41 | - else if (getenv('temp')) { |
|
40 | + } else if (getenv('temp')) { |
|
42 | 41 | $path = getenv('temp'); |
43 | 42 | } |
44 | 43 | // @codeCoverageIgnoreEnd |
@@ -81,8 +80,7 @@ discard block |
||
81 | 80 | |
82 | 81 | if (disk_driver_is_local($disk)) { |
83 | 82 | $temp = null; |
84 | - } |
|
85 | - else { |
|
83 | + } else { |
|
86 | 84 | $tempDir = larupload_temp_dir(); |
87 | 85 | $tempName = \Illuminate\Support\Carbon::now()->unix() . '-' . $name; |
88 | 86 | $temp = "$tempDir/$tempName"; |
@@ -135,8 +133,7 @@ discard block |
||
135 | 133 | } |
136 | 134 | |
137 | 135 | @rmdir($path); |
138 | - } |
|
139 | - else { |
|
136 | + } else { |
|
140 | 137 | $file = new \Symfony\Component\HttpFoundation\File\File($saveTo['temp']); |
141 | 138 | |
142 | 139 | \Illuminate\Support\Facades\Storage::disk($disk)->putFileAs( |
@@ -53,8 +53,7 @@ discard block |
||
53 | 53 | isLastOne: $this->availableQueues() === 1, |
54 | 54 | standalone: true |
55 | 55 | ); |
56 | - } |
|
57 | - else { |
|
56 | + } else { |
|
58 | 57 | /** @var Model $class */ |
59 | 58 | $class = $this->model; |
60 | 59 | $modelNotSaved = true; |
@@ -73,8 +72,7 @@ discard block |
||
73 | 72 | } |
74 | 73 | |
75 | 74 | $this->updateStatus(true, false); |
76 | - } |
|
77 | - catch (FileNotFoundException | Exception $e) { |
|
75 | + } catch (FileNotFoundException | Exception $e) { |
|
78 | 76 | $this->updateStatus(false, false, $e->getMessage()); |
79 | 77 | |
80 | 78 | throw new Exception($e->getMessage()); |
@@ -32,8 +32,7 @@ discard block |
||
32 | 32 | $table->string("{$name}_file_dominant_color", 7)->nullable(); |
33 | 33 | $table->string("{$name}_file_format", 85)->nullable(); |
34 | 34 | $table->string("{$name}_file_cover", 85)->nullable(); |
35 | - } |
|
36 | - else { |
|
35 | + } else { |
|
37 | 36 | $table->{self::jsonColumnType()}("{$name}_file_meta")->nullable(); |
38 | 37 | } |
39 | 38 | } |
@@ -65,8 +64,7 @@ discard block |
||
65 | 64 | $table->dropIndex("{$tableName}_{$name}_file_size_index"); |
66 | 65 | $table->dropIndex("{$tableName}_{$name}_file_type_index"); |
67 | 66 | $table->dropIndex("{$tableName}_{$name}_file_duration_index"); |
68 | - } |
|
69 | - else { |
|
67 | + } else { |
|
70 | 68 | $columns[] = "{$name}_file_meta"; |
71 | 69 | } |
72 | 70 |
@@ -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' |
@@ -42,14 +42,12 @@ discard block |
||
42 | 42 | $this->initializeFFMpegQueue( |
43 | 43 | $model->id, $model->getMorphClass(), $standalone |
44 | 44 | ); |
45 | - } |
|
46 | - else { |
|
45 | + } else { |
|
47 | 46 | $this->initializeFFMpegQueue( |
48 | 47 | $id, $model, $standalone |
49 | 48 | ); |
50 | 49 | } |
51 | - } |
|
52 | - else { |
|
50 | + } else { |
|
53 | 51 | $this->handleVideoStyles($id); |
54 | 52 | } |
55 | 53 | |
@@ -115,8 +113,7 @@ discard block |
||
115 | 113 | } |
116 | 114 | |
117 | 115 | return null; |
118 | - } |
|
119 | - else if ($name and $this->styleHasFile($style)) { |
|
116 | + } else if ($name and $this->styleHasFile($style)) { |
|
120 | 117 | $name = FixExceptionNamesAction::make($name, $style)->run(); |
121 | 118 | $path = $this->getBasePath($this->id, $style); |
122 | 119 |