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

Exposures   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 57.14%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 34
ccs 4
cts 7
cp 0.5714
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getExposures() 0 4 1
A search() 0 4 1
A getRange() 0 5 2
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