7
7
class MultiLineString extends GeometryCollection
8
8
{
9
9
/**
10
- * @param LineString[] $linestrings
10
+ * @param LineString[] $lineStrings
11
11
*/
12
- public function __construct (array $ linestrings )
12
+ public function __construct (array $ lineStrings )
13
13
{
14
- if (count ($ linestrings ) < 1 ) {
15
- throw new InvalidArgumentException ('$linestrings must contain at least one entry ' );
14
+ if (count ($ lineStrings ) < 1 ) {
15
+ throw new InvalidArgumentException ('$lineStrings must contain at least one entry ' );
16
16
}
17
17
18
- $ validated = array_filter ($ linestrings , function ($ value ) {
18
+ $ validated = array_filter ($ lineStrings , function ($ value ) {
19
19
return $ value instanceof LineString;
20
20
});
21
21
22
- if (count ($ linestrings ) !== count ($ validated )) {
23
- throw new InvalidArgumentException ('$linestrings must be an array of LineString ' );
22
+ if (count ($ lineStrings ) !== count ($ validated )) {
23
+ throw new InvalidArgumentException ('$lineStrings must be an array of LineString ' );
24
24
}
25
25
26
- parent ::__construct ($ linestrings );
26
+ parent ::__construct ($ lineStrings );
27
27
}
28
28
29
29
public function getLineStrings ()
@@ -39,17 +39,17 @@ public function toWKT()
39
39
public static function fromString ($ wktArgument )
40
40
{
41
41
$ str = preg_split ('/\)\s*,\s*\(/ ' , substr (trim ($ wktArgument ), 1 , -1 ));
42
- $ linestrings = array_map (function ($ data ) {
42
+ $ lineStrings = array_map (function ($ data ) {
43
43
return LineString::fromString ($ data );
44
44
}, $ str );
45
45
46
- return new static ($ linestrings );
46
+ return new static ($ lineStrings );
47
47
}
48
48
49
49
public function __toString ()
50
50
{
51
- return implode (', ' , array_map (function (LineString $ linestring ) {
52
- return sprintf ('(%s) ' , (string ) $ linestring );
51
+ return implode (', ' , array_map (function (LineString $ lineString ) {
52
+ return sprintf ('(%s) ' , (string ) $ lineString );
53
53
}, $ this ->getLineStrings ()));
54
54
}
55
55
@@ -69,12 +69,12 @@ public function offsetSet($offset, $value)
69
69
*/
70
70
public function jsonSerialize ()
71
71
{
72
- $ linestrings = [];
72
+ $ lineStrings = [];
73
73
74
- foreach ($ this ->items as $ linestring ) {
75
- $ linestrings [] = $ linestring ->jsonSerialize ();
74
+ foreach ($ this ->items as $ lineString ) {
75
+ $ lineStrings [] = $ lineString ->jsonSerialize ();
76
76
}
77
77
78
- return new \GeoJson \Geometry \MultiLineString ($ linestrings );
78
+ return new \GeoJson \Geometry \MultiLineString ($ lineStrings );
79
79
}
80
80
}
0 commit comments