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

LineString   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 0
dl 0
loc 47
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A fromLngLats() 0 8 1
A __construct() 0 3 1
A getCoordinates() 0 4 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