Completed
Pull Request — master (#316)
by Alejandro
06:47 queued 04:02
created

UnknownVisitLocation   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 39
rs 10
c 0
b 0
f 0
ccs 0
cts 10
cp 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A jsonSerialize() 0 10 1
A getLatitude() 0 3 1
A getCityName() 0 3 1
A getCountryName() 0 3 1
A getLongitude() 0 3 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Shlinkio\Shlink\Core\Visit\Model;
5
6
final class UnknownVisitLocation implements VisitLocationInterface
7
{
8
    public function getCountryName(): string
9
    {
10
        return 'Unknown';
11
    }
12
13
    public function getLatitude(): string
14
    {
15
        return '0.0';
16
    }
17
18
    public function getLongitude(): string
19
    {
20
        return '0.0';
21
    }
22
23
    public function getCityName(): string
24
    {
25
        return 'Unknown';
26
    }
27
28
    /**
29
     * Specify data which should be serialized to JSON
30
     * @link https://php.net/manual/en/jsonserializable.jsonserialize.php
31
     * @return mixed data which can be serialized by <b>json_encode</b>,
32
     * which is a value of any type other than a resource.
33
     * @since 5.4.0
34
     */
35
    public function jsonSerialize()
36
    {
37
        return [
38
            'countryCode' => 'Unknown',
39
            'countryName' => 'Unknown',
40
            'regionName' => 'Unknown',
41
            'cityName' => 'Unknown',
42
            'latitude' => '0.0',
43
            'longitude' => '0.0',
44
            'timezone' => 'Unknown',
45
        ];
46
    }
47
}
48