CountryCollection   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 80%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 17
ccs 4
cts 5
cp 0.8
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A orderByName() 0 9 2
1
<?php
2
3
namespace GeoBase\Countries\Country;
4
5
use GeoBase\Countries\ArrayCollection;
6
use GeoBase\Countries\Coordinate\CoordinateCollectionInterface;
7
use GeoBase\Countries\Language\LanguageEntity;
8
9
/**
10
 * @method CountryEntity get($key)
11
 */
12
class CountryCollection extends ArrayCollection implements CoordinateCollectionInterface
13
{
14
    /**
15
     * @param string|LanguageEntity $language
16
     *
17
     * @return $this
18
     */
19 1
    public function orderByName($language)
20
    {
21 1
        if ($language instanceof LanguageEntity) {
22
            $language = $language->getCode();
23
        }
24 1
        $this->order("names.{$language}.name");
25
26 1
        return $this;
27
    }
28
}
29