@@ -29,7 +29,7 @@ |
||
29 | 29 | protected int $ffmpegMaxQueueNum; |
30 | 30 | |
31 | 31 | |
32 | - protected function ffmpeg(UploadedFile $file = null, AudioStyle|VideoStyle|null $style = null): FFMpeg |
|
32 | + protected function ffmpeg(UploadedFile $file = null, AudioStyle | VideoStyle | null $style = null): FFMpeg |
|
33 | 33 | { |
34 | 34 | $force = false; |
35 | 35 |
@@ -80,14 +80,14 @@ |
||
80 | 80 | return $this; |
81 | 81 | } |
82 | 82 | |
83 | - public function video(string $name, ?int $width = null, ?int $height = null, LaruploadMediaStyle $mode = LaruploadMediaStyle::SCALE_HEIGHT, X264|WebM|Ogg|Mp3|Aac|Wav|Flac $format = new X264, bool $padding = false): UploadEntities |
|
83 | + public function video(string $name, ?int $width = null, ?int $height = null, LaruploadMediaStyle $mode = LaruploadMediaStyle::SCALE_HEIGHT, X264 | WebM | Ogg | Mp3 | Aac | Wav | Flac $format = new X264, bool $padding = false): UploadEntities |
|
84 | 84 | { |
85 | 85 | $this->videoStyles[$name] = VideoStyle::make($name, $width, $height, $mode, $format, $padding); |
86 | 86 | |
87 | 87 | return $this; |
88 | 88 | } |
89 | 89 | |
90 | - public function audio(string $name, Mp3|Aac|Wav|Flac $format = new Mp3): UploadEntities |
|
90 | + public function audio(string $name, Mp3 | Aac | Wav | Flac $format = new Mp3): UploadEntities |
|
91 | 91 | { |
92 | 92 | $this->audioStyles[$name] = AudioStyle::make($name, $format); |
93 | 93 |
@@ -16,9 +16,9 @@ discard block |
||
16 | 16 | class VideoStyle extends Style |
17 | 17 | { |
18 | 18 | public readonly LaruploadMediaStyle $mode; |
19 | - public readonly X264|WebM|Ogg|Mp3|Aac|Wav|Flac $format; |
|
19 | + public readonly X264 | WebM | Ogg | Mp3 | Aac | Wav | Flac $format; |
|
20 | 20 | |
21 | - public function __construct(string $name, ?int $width = null, ?int $height = null, LaruploadMediaStyle $mode = LaruploadMediaStyle::SCALE_HEIGHT, X264|WebM|Ogg|Mp3|Aac|Wav|Flac $format = new X264, bool $padding = false) |
|
21 | + public function __construct(string $name, ?int $width = null, ?int $height = null, LaruploadMediaStyle $mode = LaruploadMediaStyle::SCALE_HEIGHT, X264 | WebM | Ogg | Mp3 | Aac | Wav | Flac $format = new X264, bool $padding = false) |
|
22 | 22 | { |
23 | 23 | parent::__construct($name, $width, $height, $padding); |
24 | 24 | |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | $this->validateDimension(); |
29 | 29 | } |
30 | 30 | |
31 | - public static function make(string $name, ?int $width = null, ?int $height = null, LaruploadMediaStyle $mode = LaruploadMediaStyle::SCALE_HEIGHT, X264|WebM|Ogg|Mp3|Aac|Wav|Flac $format = new X264, bool $padding = false): self |
|
31 | + public static function make(string $name, ?int $width = null, ?int $height = null, LaruploadMediaStyle $mode = LaruploadMediaStyle::SCALE_HEIGHT, X264 | WebM | Ogg | Mp3 | Aac | Wav | Flac $format = new X264, bool $padding = false): self |
|
32 | 32 | { |
33 | 33 | return new self($name, $width, $height, $mode, $format, $padding); |
34 | 34 | } |
@@ -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' |