Test Failed
Pull Request — master (#31)
by
unknown
04:02
created

AudioStyle   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 17
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A make() 0 3 1
1
<?php
2
3
namespace Mostafaznv\Larupload\DTOs\Style;
4
5
use Exception;
6
use FFMpeg\Format\Audio\Aac;
7
use FFMpeg\Format\Audio\Flac;
8
use FFMpeg\Format\Audio\Mp3;
9
use FFMpeg\Format\Audio\Wav;
10
use Mostafaznv\Larupload\Enums\LaruploadMediaStyle;
11
12
class AudioStyle extends Style
13
{
14
    public readonly LaruploadMediaStyle $mode;
15
    public readonly Mp3|Aac|Wav|Flac $format;
16
17
    public function __construct(string $name, Mp3|Aac|Wav|Flac $format = new Mp3, int $bitrate = 128)
18
    {
19
        parent::__construct($name);
20
21
        $format->setAudioKiloBitrate($bitrate);
22
23
        $this->format = $format;
0 ignored issues
show
Bug introduced by
The property format is declared read-only in Mostafaznv\Larupload\DTOs\Style\AudioStyle.
Loading history...
24
    }
25
26
    public static function make(string $name, Mp3|Aac|Wav|Flac $format = new Mp3, int $bitrate = 128): self
27
    {
28
        return new self($name, $format, $bitrate);
29
    }
30
}
31