Passed
Push — master ( e47858...55d38d )
by Carsten
02:40
created

Zones   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 31
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getZones() 0 4 1
A search() 0 4 1
A getExposures() 0 6 1
1
<?php
2
namespace FilmTools\Commons;
3
4
5
class Zones extends MinMaxArrayIterator implements ZonesInterface, ZonesProviderInterface
6
{
7
    /**
8
     * @inheritDoc
9
     * @return $this
10
     */
11 9
    public function getZones() : ZonesInterface
12
    {
13 9
        return $this;
14
    }
15
16
    /**
17
     * @inheritDoc
18
     */
19 9
    public function search( float $zone )
20
    {
21 9
        return array_search($zone, $this->getArrayCopy());
0 ignored issues
show
Bug Compatibility introduced by
The expression array_search($zone, $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
     * @return Exposures
28
     */
29
    public function getExposures() : ExposuresInterface
30
    {
31 9
        return new Exposures( array_map( function( $zone ) {
32 9
            return $zone * log10(2);
33 9
        }, $this->getArrayCopy()));
34
    }
35
}
36