Sample::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
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