Completed
Push — master ( af7add...6e606c )
by Karsten
02:11
created

LineString::fromLngLats()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 1
crap 1
1
<?php
2
/**
3
 * File was created 11.03.2016 07:27
4
 */
5
6
namespace PeekAndPoke\Component\GeoJson;
7
8
/**
9
 * @author Karsten J. Gerber <[email protected]>
10
 */
11
class LineString
12
{
13
    public const TYPE = 'LineString';
14
15
    /**
16
     * @var float[][]
17
     */
18
    private $coordinates;
19
20
    /**
21
     * Create a LineString object from coordinates
22
     *
23
     * The coordinates must be in Long-Lat order. Example:
24
     *
25
     * <code>
26
     *
27
     * LineString::from([10.1, 20.2, 10.2, 20.3])
28
     *
29
     * </code>
30
     *
31
     * @param array $coordinates The coordinates as pairs of Long-Lat
32
     *
33
     * @return LineString
34
     */
35 4
    public static function fromLngLats(array $coordinates)
36
    {
37 4
        $ret = new self;
38
39 4
        $ret->coordinates = $coordinates;
40
41 4
        return $ret;
42
    }
43
44
    /**
45
     */
46 4
    protected function __construct()
47
    {
48 4
    }
49
50
    /**
51
     * @return \float[][]
52
     */
53 2
    public function getCoordinates()
54
    {
55 2
        return $this->coordinates;
56
    }
57
}
58