@@ -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( |
@@ -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 |
@@ -61,25 +61,20 @@ discard block |
||
61 | 61 | |
62 | 62 | if ($style->mode === LaruploadMediaStyle::SCALE_HEIGHT and $style->width) { |
63 | 63 | $this->resizeLandscape($style->width); |
64 | - } |
|
65 | - else if ($style->mode == LaruploadMediaStyle::SCALE_WIDTH and $style->height) { |
|
64 | + } else if ($style->mode == LaruploadMediaStyle::SCALE_WIDTH and $style->height) { |
|
66 | 65 | $this->resizePortrait($style->height); |
67 | - } |
|
68 | - else if ($style->mode == LaruploadMediaStyle::CROP and $style->height and $style->width) { |
|
66 | + } else if ($style->mode == LaruploadMediaStyle::CROP and $style->height and $style->width) { |
|
69 | 67 | $this->resizeCrop($style->width, $style->height); |
70 | - } |
|
71 | - else if ($style->mode == LaruploadMediaStyle::FIT and $style->height and $style->width) { |
|
68 | + } else if ($style->mode == LaruploadMediaStyle::FIT and $style->height and $style->width) { |
|
72 | 69 | $this->resizeExact($style->width, $style->height); |
73 | - } |
|
74 | - else { |
|
70 | + } else { |
|
75 | 71 | $this->resizeAuto($style->width, $style->height); |
76 | 72 | } |
77 | 73 | |
78 | 74 | |
79 | 75 | if ($this->driverIsLocal) { |
80 | 76 | $this->save($saveTo); |
81 | - } |
|
82 | - else { |
|
77 | + } else { |
|
83 | 78 | list($path, $name) = split_larupload_path($saveTo); |
84 | 79 | |
85 | 80 | $tempDir = larupload_temp_dir(); |
@@ -110,8 +105,7 @@ discard block |
||
110 | 105 | |
111 | 106 | if ($file instanceof UploadedFile) { |
112 | 107 | $path = $file->getRealPath(); |
113 | - } |
|
114 | - else if (file_exists($file)) { |
|
108 | + } else if (file_exists($file)) { |
|
115 | 109 | $path = $file; |
116 | 110 | } |
117 | 111 |
@@ -66,8 +66,7 @@ |
||
66 | 66 | |
67 | 67 | $model->{"{$this->name}_file_$key"} = $value; |
68 | 68 | } |
69 | - } |
|
70 | - else { |
|
69 | + } else { |
|
71 | 70 | $model->{"{$this->name}_file_name"} = $this->output['name'] ?? null; |
72 | 71 | $model->{"{$this->name}_file_meta"} = json_encode($this->output); |
73 | 72 | } |
@@ -55,8 +55,7 @@ discard block |
||
55 | 55 | isLastOne: $this->availableQueues() === 1, |
56 | 56 | standalone: true |
57 | 57 | ); |
58 | - } |
|
59 | - else { |
|
58 | + } else { |
|
60 | 59 | /** @var Model $class */ |
61 | 60 | $class = class_exists($this->model) ? $this->model : Relation::getMorphedModel($this->model); |
62 | 61 | $modelNotSaved = true; |
@@ -75,8 +74,7 @@ discard block |
||
75 | 74 | } |
76 | 75 | |
77 | 76 | $this->updateStatus(true, false); |
78 | - } |
|
79 | - catch (FileNotFoundException | Exception $e) { |
|
77 | + } catch (FileNotFoundException | Exception $e) { |
|
80 | 78 | $this->updateStatus(false, false, $e->getMessage()); |
81 | 79 | |
82 | 80 | throw new Exception($e->getMessage()); |
@@ -30,11 +30,9 @@ |
||
30 | 30 | { |
31 | 31 | if ($this->format instanceof Aac) { |
32 | 32 | return 'aac'; |
33 | - } |
|
34 | - else if ($this->format instanceof Wav) { |
|
33 | + } else if ($this->format instanceof Wav) { |
|
35 | 34 | return 'wav'; |
36 | - } |
|
37 | - else if ($this->format instanceof Flac) { |
|
35 | + } else if ($this->format instanceof Flac) { |
|
38 | 36 | return 'flac'; |
39 | 37 | } |
40 | 38 |
@@ -25,8 +25,7 @@ discard block |
||
25 | 25 | |
26 | 26 | if ($this->type == LaruploadFileType::VIDEO) { |
27 | 27 | $this->handleVideoStyles($this->id); |
28 | - } |
|
29 | - else if ($this->type == LaruploadFileType::AUDIO) { |
|
28 | + } else if ($this->type == LaruploadFileType::AUDIO) { |
|
30 | 29 | $this->handleAudioStyles($this->id); |
31 | 30 | } |
32 | 31 | |
@@ -44,8 +43,7 @@ discard block |
||
44 | 43 | |
45 | 44 | if ($maxQueueNum == 0) { |
46 | 45 | $flag = true; |
47 | - } |
|
48 | - else { |
|
46 | + } else { |
|
49 | 47 | $availableQueues = DB::table(Larupload::FFMPEG_QUEUE_TABLE) |
50 | 48 | ->where('status', 0) |
51 | 49 | ->count(); |
@@ -82,8 +80,7 @@ discard block |
||
82 | 80 | |
83 | 81 | |
84 | 82 | ProcessFFMpeg::dispatch($queueId, $id, $this->name, $class, $serializedClass); |
85 | - } |
|
86 | - else { |
|
83 | + } else { |
|
87 | 84 | throw new HttpResponseException(redirect(URL::previous())->withErrors([ |
88 | 85 | 'ffmpeg_queue_max_num' => trans('larupload::messages.max-queue-num-exceeded') |
89 | 86 | ])); |
@@ -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 | |
@@ -65,14 +63,12 @@ discard block |
||
65 | 63 | $this->initializeFFMpegQueue( |
66 | 64 | $model->id, $model->getMorphClass(), $standalone |
67 | 65 | ); |
68 | - } |
|
69 | - else { |
|
66 | + } else { |
|
70 | 67 | $this->initializeFFMpegQueue( |
71 | 68 | $id, $model, $standalone |
72 | 69 | ); |
73 | 70 | } |
74 | - } |
|
75 | - else { |
|
71 | + } else { |
|
76 | 72 | $this->handleAudioStyles($id); |
77 | 73 | } |
78 | 74 | |
@@ -154,8 +150,7 @@ discard block |
||
154 | 150 | } |
155 | 151 | |
156 | 152 | return null; |
157 | - } |
|
158 | - else if ($name and $this->styleHasFile($style)) { |
|
153 | + } else if ($name and $this->styleHasFile($style)) { |
|
159 | 154 | |
160 | 155 | $name = FixExceptionNamesAction::make($name, $style, $this->getStyle($style))->run(); |
161 | 156 | $path = $this->getBasePath($this->id, $style); |
@@ -50,20 +50,15 @@ discard block |
||
50 | 50 | { |
51 | 51 | if ($this->format instanceof WebM) { |
52 | 52 | return 'webm'; |
53 | - } |
|
54 | - else if ($this->format instanceof Ogg) { |
|
53 | + } else if ($this->format instanceof Ogg) { |
|
55 | 54 | return 'ogg'; |
56 | - } |
|
57 | - else if ($this->format instanceof Mp3) { |
|
55 | + } else if ($this->format instanceof Mp3) { |
|
58 | 56 | return 'mp3'; |
59 | - } |
|
60 | - else if ($this->format instanceof Aac) { |
|
57 | + } else if ($this->format instanceof Aac) { |
|
61 | 58 | return 'aac'; |
62 | - } |
|
63 | - else if ($this->format instanceof Wav) { |
|
59 | + } else if ($this->format instanceof Wav) { |
|
64 | 60 | return 'wav'; |
65 | - } |
|
66 | - else if ($this->format instanceof Flac) { |
|
61 | + } else if ($this->format instanceof Flac) { |
|
67 | 62 | return 'flac'; |
68 | 63 | } |
69 | 64 | |
@@ -82,22 +77,19 @@ discard block |
||
82 | 77 | 'Width is required when you are in SCALE_HEIGHT mode' |
83 | 78 | ); |
84 | 79 | } |
85 | - } |
|
86 | - else if ($this->mode === LaruploadMediaStyle::SCALE_WIDTH) { |
|
80 | + } else if ($this->mode === LaruploadMediaStyle::SCALE_WIDTH) { |
|
87 | 81 | if ($this->height === null or $this->height === 0) { |
88 | 82 | throw new Exception( |
89 | 83 | 'Height is required when you are in SCALE_WIDTH mode' |
90 | 84 | ); |
91 | 85 | } |
92 | - } |
|
93 | - else if (in_array($this->mode, [LaruploadMediaStyle::CROP, LaruploadMediaStyle::FIT])) { |
|
86 | + } else if (in_array($this->mode, [LaruploadMediaStyle::CROP, LaruploadMediaStyle::FIT])) { |
|
94 | 87 | if (!$this->width or !$this->height) { |
95 | 88 | throw new Exception( |
96 | 89 | 'Width and Height are required when you are in CROP/FIT mode' |
97 | 90 | ); |
98 | 91 | } |
99 | - } |
|
100 | - else if ($this->mode === LaruploadMediaStyle::AUTO) { |
|
92 | + } else if ($this->mode === LaruploadMediaStyle::AUTO) { |
|
101 | 93 | if (!$this->width and !$this->height) { |
102 | 94 | throw new Exception( |
103 | 95 | 'Width and height are required when you are in auto mode' |