Passed
Push — master ( ac7cac...af560c )
by Sébastien
02:21
created

DetectionService   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A detectInterlacement() 0 5 1
A __construct() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Soluble\MediaTools\Video;
6
7
use Soluble\MediaTools\Config\FFMpegConfigInterface;
8
use Soluble\MediaTools\Video\Detection\InterlaceDetect;
9
use Soluble\MediaTools\Video\Detection\InterlaceDetectGuess;
10
use Soluble\MediaTools\Video\Exception\DetectionExceptionInterface;
11
use Soluble\MediaTools\Video\Exception\DetectionProcessExceptionInterface;
12
use Soluble\MediaTools\Video\Exception\MissingInputFileException;
13
use Soluble\MediaTools\Video\Exception\ProcessFailedException;
14
use Soluble\MediaTools\Video\Exception\RuntimeException;
15
16
class DetectionService implements DetectionServiceInterface
17
{
18
    /** @var FFMpegConfigInterface */
19
    protected $ffmpegConfig;
20
21 2
    public function __construct(FFMpegConfigInterface $ffmpegConfig)
22
    {
23 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...
24 2
    }
25
26
    /**
27
     * @param int $maxFramesToAnalyze interlacement detection can be heavy, limit the number of frames to analyze
28
     *
29
     * @throws DetectionExceptionInterface
30
     * @throws DetectionProcessExceptionInterface
31
     * @throws ProcessFailedException
32
     * @throws MissingInputFileException
33
     * @throws RuntimeException
34
     */
35 2
    public function detectInterlacement(string $file, int $maxFramesToAnalyze = InterlaceDetect::DEFAULT_INTERLACE_MAX_FRAMES): InterlaceDetectGuess
36
    {
37 2
        $interlaceDetect = new InterlaceDetect($this->ffmpegConfig);
38
39 2
        return $interlaceDetect->guessInterlacing($file, $maxFramesToAnalyze);
40
    }
41
}
42