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

Coordinates::getLongitude()   A

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