Completed
Push — master ( dd11e3...886d11 )
by Carsten
02:34 queued 12s
created

GeoDataAwareTrait   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 25
ccs 7
cts 7
cp 1
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|GeoDataProviderInterface
13
     * @return self
14
     */
15 12
    public function setGeoData( $geodata )
16
    {
17 12
        if ($geodata instanceOf GeoDataInterface):
18 2
            $this->geodata = $geodata;
19 10
        elseif ($geodata instanceOf GeoDataProviderInterface):
20 2
            $this->geodata = $geodata->getGeoData();
21
        else:
22 8
            throw new \InvalidArgumentException("GeoDataInterface or GeoDataProviderInterface expected");
23
        endif;
24
25 4
        return $this;
26
    }
27
28
}
29