Passed
Push — master ( 1e8bfe...85c284 )
by Sébastien
03:02
created

VideoDetectionService::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Soluble\MediaTools;
6
7
use Soluble\MediaTools\Config\FFMpegConfig;
8
use Soluble\MediaTools\Exception\FileNotFoundException;
9
use Soluble\MediaTools\Video\Detection\InterlaceDetect;
10
use Soluble\MediaTools\Video\Detection\InterlaceDetectGuess;
11
use Soluble\MediaTools\Video\DetectionServiceInterface;
12
use Symfony\Component\Process\Exception\RuntimeException as SPRuntimeException;
13
14
class VideoDetectionService implements DetectionServiceInterface
15
{
16
    /** @var FFMpegConfig */
17
    protected $ffmpegConfig;
18
19 2
    public function __construct(FFMpegConfig $ffmpegConfig)
20
    {
21 2
        $this->ffmpegConfig  = $ffmpegConfig;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned correctly; expected 1 space but found 2 spaces

This check looks for improperly formatted assignments.

Every assignment must have exactly one space before and one space after the equals operator.

To illustrate:

$a = "a";
$ab = "ab";
$abc = "abc";

will have no issues, while

$a   = "a";
$ab  = "ab";
$abc = "abc";

will report issues in lines 1 and 2.

Loading history...
22 2
    }
23
24
    /**
25
     * @param int $maxFramesToAnalyze interlacement detection can be heavy, limit the number of frames to analyze
26
     *
27
     * @throws SPRuntimeException
28
     * @throws FileNotFoundException
29
     */
30 2
    public function detectInterlacement(string $file, int $maxFramesToAnalyze = InterlaceDetect::DEFAULT_INTERLACE_MAX_FRAMES): InterlaceDetectGuess
31
    {
32 2
        $interlaceDetect = new InterlaceDetect($this->ffmpegConfig);
33
34 2
        return $interlaceDetect->guessInterlacing($file, $maxFramesToAnalyze);
35
    }
36
}
37