Passed
Push — master ( 539757...2d32e6 )
by Carsten
05:57
created

Exposures::getRange()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 0
cts 3
cp 0
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 6
1
<?php
2
namespace FilmTools\Commons;
3
4
5
class Exposures extends MinMaxArrayIterator implements ExposuresInterface, ExposuresProviderInterface
6
{
7
8
    /**
9
     * @inheritDoc
10
     * @return $this
11
     */
12 12
    public function getExposures() : ExposuresInterface
13
    {
14 12
        return $this;
15
    }
16
17
    /**
18
     * @inheritDoc
19
     */
20 12
    public function search( float $logH )
21
    {
22 12
        return array_search($logH, $this->getArrayCopy());
0 ignored issues
show
Bug Compatibility introduced by
The expression array_search($logH, $this->getArrayCopy()); of type false|integer|string adds the type string to the return on line 22 which is incompatible with the return type declared by the interface FilmTools\Commons\SearchableInterface::search of type integer|false.
Loading history...
23
    }
24
25
26
    /**
27
     * @inheritDoc
28
     *
29
     * The range step width used here is a third of `log10(2) = 0.301...`.
30
     * The numbers will most likely cleanly round to multiples of 0.1 though.
31
     */
32
    public function getRange( float $step = null) : \SplFixedArray
33
    {
34
        $step = is_null($step) ? (log10(2) / 3) : $step;
35
        return parent::getRange( $step );
36
    }
37
38
}
39