GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — geo-json ( 2f8622 )
by Eric
02:55
created

LayerManager::addGeoJsonLayers()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 6
rs 9.4285
cc 2
eloc 3
nc 2
nop 1
1
<?php
2
3
/*
4
 * This file is part of the Ivory Google Map package.
5
 *
6
 * (c) Eric GELOEN <[email protected]>
7
 *
8
 * For the full copyright and license information, please read the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Ivory\GoogleMap\Layer;
13
14
/**
15
 * @author GeLo <[email protected]>
16
 */
17
class LayerManager
18
{
19
    /**
20
     * @var GeoJsonLayer[]
21
     */
22
    private $geoJsonLayers = [];
23
24
    /**
25
     * @var KmlLayer[]
26
     */
27
    private $kmlLayers = [];
28
29
    /**
30
     * @return bool
31
     */
32
    public function hasGeoJsonLayers()
33
    {
34
        return !empty($this->geoJsonLayers);
35
    }
36
37
    /**
38
     * @return GeoJsonLayer[]
39
     */
40
    public function getGeoJsonLayers()
41
    {
42
        return $this->geoJsonLayers;
43
    }
44
45
    /**
46
     * @param GeoJsonLayer[] $geoJsonLayers
47
     */
48
    public function setGeoJsonLayers(array $geoJsonLayers)
49
    {
50
        $this->geoJsonLayers = [];
51
        $this->addGeoJsonLayers($geoJsonLayers);
52
    }
53
54
    /**
55
     * @param GeoJsonLayer[] $geoJsonLayers
56
     */
57
    public function addGeoJsonLayers(array $geoJsonLayers)
58
    {
59
        foreach ($geoJsonLayers as $geoJsonLayer) {
60
            $this->addGeoJsonLayer($geoJsonLayer);
61
        }
62
    }
63
64
    /**
65
     * @param GeoJsonLayer $geoJsonLayer
66
     *
67
     * @return bool
68
     */
69
    public function hasGeoJsonLayer(GeoJsonLayer $geoJsonLayer)
70
    {
71
        return in_array($geoJsonLayer, $this->geoJsonLayers, true);
72
    }
73
74
    /**
75
     * @param GeoJsonLayer $geoJsonLayer
76
     */
77
    public function addGeoJsonLayer(GeoJsonLayer $geoJsonLayer)
78
    {
79
        if (!$this->hasGeoJsonLayer($geoJsonLayer)) {
80
            $this->geoJsonLayers[] = $geoJsonLayer;
81
        }
82
    }
83
84
    /**
85
     * @param GeoJsonLayer $geoJsonLayer
86
     */
87
    public function removeGeoJsonLayer(GeoJsonLayer $geoJsonLayer)
88
    {
89
        unset($this->geoJsonLayers[array_search($geoJsonLayer, $this->geoJsonLayers, true)]);
90
    }
91
92
    /**
93
     * @return bool
94
     */
95
    public function hasKmlLayers()
96
    {
97
        return !empty($this->kmlLayers);
98
    }
99
100
    /**
101
     * @return KmlLayer[]
102
     */
103
    public function getKmlLayers()
104
    {
105
        return $this->kmlLayers;
106
    }
107
108
    /**
109
     * @param KmlLayer[] $kmlLayers
110
     */
111
    public function setKmlLayers(array $kmlLayers)
112
    {
113
        $this->kmlLayers = [];
114
        $this->addKmlLayers($kmlLayers);
115
    }
116
117
    /**
118
     * @param KmlLayer[] $kmlLayers
119
     */
120
    public function addKmlLayers(array $kmlLayers)
121
    {
122
        foreach ($kmlLayers as $kmlLayer) {
123
            $this->addKmlLayer($kmlLayer);
124
        }
125
    }
126
127
    /**
128
     * @param KmlLayer $kmlLayer
129
     *
130
     * @return bool
131
     */
132
    public function hasKmlLayer(KmlLayer $kmlLayer)
133
    {
134
        return in_array($kmlLayer, $this->kmlLayers, true);
135
    }
136
137
    /**
138
     * @param KmlLayer $kmlLayer
139
     */
140
    public function addKmlLayer(KmlLayer $kmlLayer)
141
    {
142
        if (!$this->hasKmlLayer($kmlLayer)) {
143
            $this->kmlLayers[] = $kmlLayer;
144
        }
145
    }
146
147
    /**
148
     * @param KmlLayer $kmlLayer
149
     */
150
    public function removeKmlLayer(KmlLayer $kmlLayer)
151
    {
152
        unset($this->kmlLayers[array_search($kmlLayer, $this->kmlLayers, true)]);
153
    }
154
}
155