Failed Conditions
Push — master ( 16370c...4fb215 )
by Sébastien
02:43
created

SelectFilter   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 6
dl 0
loc 25
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getFFmpegCLIValue() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Soluble\MediaTools\Video\Filter;
6
7
use Soluble\MediaTools\Video\Filter\Type\FFMpegVideoFilterInterface;
8
9
class SelectFilter implements FFMpegVideoFilterInterface
10
{
11
    /**
12
     * @var null|string
13
     */
14
    private $expression;
15
16
    /**
17
     * Select filter.
18
     *
19
     * @see https://ffmpeg.org/ffmpeg-filters.html#select_002c-aselect
20
     *
21
     * @param string|null $expression ffmpeg selected expression
22
     */
23 1
    public function __construct(
24
        string $expression = null
25
    ) {
26 1
        $this->expression = $expression;
27 1
    }
28
29 1
    public function getFFmpegCLIValue(): string
30
    {
31 1
        return sprintf(
32 1
            '"select=%s"',
33 1
            str_replace('"', '\"', $this->expression ?? '')
34
        );
35
    }
36
}
37