Passed
Push — master ( db9c4a...2cdaae )
by Jhao
02:59
created

Coordinates   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 34
ccs 0
cts 22
cp 0
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getLatitude() 0 3 1
A __construct() 0 4 1
A toArray() 0 5 1
A create() 0 3 1
A getLongitude() 0 3 1
1
<?php
2
3
/**
4
 * This file is part of RussianPost SDK package.
5
 *
6
 * © Appwilio (http://appwilio.com), JhaoDa (https://github.com/jhaoda)
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace Appwilio\RussianPostSDK\Dispatching\Entities;
15
16
use Appwilio\RussianPostSDK\Dispatching\Contracts\Arrayable;
17
18
final class Coordinates implements Arrayable
19
{
20
    /** @var float */
21
    private $latitude;
22
23
    /** @var float */
24
    private $longitude;
25
26
    public static function create(float $latitude, float $longitude): self
27
    {
28
        return new self(...\func_get_args());
29
    }
30
31
    public function __construct(float $latitude, float $longitude)
32
    {
33
        $this->latitude = $latitude;
34
        $this->longitude = $longitude;
35
    }
36
37
    public function getLatitude(): float
38
    {
39
        return $this->latitude;
40
    }
41
42
    public function getLongitude(): float
43
    {
44
        return $this->longitude;
45
    }
46
47
    public function toArray(): array
48
    {
49
        return [
50
            'latitude'  => $this->latitude,
51
            'longitude' => $this->longitude,
52
        ];
53
    }
54
}
55