Sample::byCountries()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 11
ccs 0
cts 7
cp 0
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 6
1
<?php
2
3
namespace PierInfor\GeoLite;
4
5
class Sample extends Ip
6
{
7
    
8
    public function __construct($locales = ['fr'])
9
    {
10
        parent::__construct($locales);
11
    }
12
13
    public function byCities(int $colSort = 1): Ip
14
    {
15
        try {
16
            $this
17
                ->setAdapter(self::ADAPTER_COUNTRY)
18
                ->process()
19
                ->sort($colSort);
20
        } catch (\Exception $e) {
21
            echo $e->getMessage();
22
        }
23
        return $this;
24
    }
25
26
    public function byCountries(int $colSort = 1): Ip
27
    {
28
        try {
29
            $this
30
                ->setAdapter(self::ADAPTER_CITY)
31
                ->process()
32
                ->sort($colSort);
33
        } catch (\Exception $e) {
34
            echo $e->getMessage();
35
        }
36
        return $this;
37
    }
38
}
39