Completed
Push — master ( eea56f...dd11e3 )
by Carsten
02:43 queued 15s
created

GeoDataAwareTrait   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 85.71%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A setGeoData() 0 12 3
1
<?php
2
namespace Germania\GeoData;
3
4
trait GeoDataAwareTrait
5
{
6
7
    use GeoDataProviderTrait;
8
9
10
11
    /**
12
     * @param GeoDataInterface
13
     * @return self
14
     */
15 4
    public function setGeoData( $geodata ) : self
16
    {
17 4
        if ($geodata instanceOf GeoDataInterface):
18 2
            $this->geodata = $geodata;
19 2
        elseif ($geodata instanceOf GeoDataProviderInterface):
20 2
            $this->geodata = $geodata->getGeoData();
21
        else:
22
            throw new \InvalidArgumentException("GeoDataInterface or GeoDataProviderInterface expected");
23
        endif;
24
25 4
        return $this;
26
    }
27
28
}
29