MultiPolygon::pointOnVertex()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 3

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 11
ccs 5
cts 5
cp 1
rs 9.9
cc 3
nc 3
nop 1
crap 3
1
<?php
2
3
namespace League\Geotools\Polygon;
4
5
use League\Geotools\Coordinate\CoordinateInterface;
6
use League\Geotools\GeometryCollection;
7
8
class MultiPolygon extends GeometryCollection implements PolygonInterface
9
{
10
    const TYPE = 'MULTIPOLYGON';
11
12
    /**
13
     * @return string
14
     */
15 1
    public function getGeometryType()
16
    {
17 1
        return self::TYPE;
18
    }
19
20
    /**
21
     * @param  CoordinateInterface $coordinate
22
     * @return boolean
23
     */
24 2
    public function pointInPolygon(CoordinateInterface $coordinate)
25
    {
26
        /** @var PolygonInterface $polygon */
27 2
        foreach ($this->elements as $polygon) {
28 2
            if ($polygon->pointInPolygon($coordinate)) {
29 2
                return true;
30
            }
31
        }
32
33 1
        return false;
34
    }
35
36
    /**
37
     * @param  CoordinateInterface $coordinate
38
     * @return boolean
39
     */
40 2
    public function pointOnBoundary(CoordinateInterface $coordinate)
41
    {
42
        /** @var PolygonInterface $polygon */
43 2
        foreach ($this->elements as $polygon) {
44 2
            if ($polygon->pointOnBoundary($coordinate)) {
45 2
                return true;
46
            }
47
        }
48
49 1
        return false;
50
    }
51
52
    /**
53
     * @param  CoordinateInterface $coordinate
54
     * @return boolean
55
     */
56 2
    public function pointOnVertex(CoordinateInterface $coordinate)
57
    {
58
        /** @var PolygonInterface $polygon */
59 2
        foreach ($this->elements as $polygon) {
60 2
            if ($polygon->pointOnVertex($coordinate)) {
61 2
                return true;
62
            }
63
        }
64
65 1
        return false;
66
    }
67
}
68