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

VideoStreamCollection::count()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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