Passed
Push — master ( 62a8b8...1f3823 )
by Carsten
07:50 queued 10s
created

FStops::getZones()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
namespace FilmTools\Commons;
3
4
5
class FStops extends MinMaxArrayIterator implements FStopsInterface, FStopsProviderInterface
6
{
7
    /**
8
     * @inheritDoc
9
     * @return $this
10
     */
11
    public function getFStops() : FStopsInterface
12
    {
13
        return $this;
14
    }
15
16
    /**
17
     * @inheritDoc
18
     */
19 12
    public function search( float $fstop )
20
    {
21 12
        return array_search($fstop, $this->getArrayCopy());
0 ignored issues
show
Bug Compatibility introduced by
The expression array_search($fstop, $this->getArrayCopy()); of type false|integer|string adds the type string to the return on line 21 which is incompatible with the return type declared by the interface FilmTools\Commons\SearchableInterface::search of type integer|false.
Loading history...
22
    }
23
24
25
    /**
26
     * @inheritDoc
27
     */
28 24
    public function getZones() : ZonesInterface
29
    {
30 24
        $min = $this->min();
31 6
        return new Zones( array_map( function( $fstop ) use ($min) {
32 24
            return $fstop + $min;
33 24
        }, $this->getArrayCopy()));
34
    }
35
36
37
    /**
38
     * @inheritDoc
39
     * @return ExposuresInterface
40
     */
41 12
    public function getExposures() : ExposuresInterface
42
    {
43 12
        return $this->getZones()->getExposures();
44
    }
45
}
46