Passed
Push — master ( b38e7e...085481 )
by Sébastien
03:00
created

VideoStreamCollection   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Test Coverage

Coverage 55.56%

Importance

Changes 0
Metric Value
wmc 4
eloc 6
dl 0
loc 28
c 0
b 0
f 0
ccs 5
cts 9
cp 0.5556
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A count() 0 3 1
A getIterator() 0 3 1
A __construct() 0 3 1
A getFirst() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Soluble\MediaTools\Video\Info;
6
7
class VideoStreamCollection implements StreamCollectionInterface
8
{
9
    /**
10
     * @var array<int, array>
11
     */
12
    private $streamsMetadata;
13
14
    /**
15
     * @param array<int, array> $videoStreamsMetadata
16
     */
17 1
    public function __construct(array $videoStreamsMetadata)
18
    {
19 1
        $this->streamsMetadata = $videoStreamsMetadata;
20 1
    }
21
22 1
    public function getFirst(): VideoStream
23
    {
24 1
        return new VideoStream($this->streamsMetadata[0]);
25
    }
26
27
    public function count(): int
28
    {
29
        return count($this->streamsMetadata);
30
    }
31
32
    public function getIterator(): \ArrayIterator
33
    {
34
        return new \ArrayIterator($this->streamsMetadata);
35
    }
36
}
37