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

SelectFilter::getFFmpegCLIValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 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