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 — map-manager-relation ( ddc93b )
by Eric
02:26
created

EventManager::setMap()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
rs 9.4285
cc 2
eloc 4
nc 2
nop 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A EventManager::addDomEvents() 0 6 2
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\Event;
13
14
/**
15
 * @see http://code.google.com/apis/maps/documentation/javascript/reference.html#MapsEventListener
16
 *
17
 * @author GeLo <[email protected]>
18
 */
19
class EventManager
20
{
21
    /**
22
     * @var Event[]
23
     */
24
    private $domEvents = [];
25
26
    /**
27
     * @var Event[]
28
     */
29
    private $domEventsOnce = [];
30
31
    /**
32
     * @var Event[]
33
     */
34
    private $events = [];
35
36
    /**
37
     * @var Event[]
38
     */
39
    private $eventsOnce = [];
40
41
    /**
42
     * @return bool
43
     */
44
    public function hasDomEvents()
45
    {
46
        return !empty($this->domEvents);
47
    }
48
49
    /**
50
     * @return Event[]
51
     */
52
    public function getDomEvents()
53
    {
54
        return $this->domEvents;
55
    }
56
57
    /**
58
     * @param Event[] $domEvents
59
     */
60
    public function setDomEvents(array $domEvents)
61
    {
62
        $this->domEvents = [];
63
        $this->addDomEvents($domEvents);
64
    }
65
66
    /**
67
     * @param Event[] $domEvents
68
     */
69
    public function addDomEvents(array $domEvents)
70
    {
71
        foreach ($domEvents as $domEvent) {
72
            $this->addDomEvent($domEvent);
73
        }
74
    }
75
76
    /**
77
     * @param Event $domEvent
78
     *
79
     * @return bool
80
     */
81
    public function hasDomEvent(Event $domEvent)
82
    {
83
        return in_array($domEvent, $this->domEvents, true);
84
    }
85
86
    /**
87
     * @param Event $domEvent
88
     */
89
    public function addDomEvent(Event $domEvent)
90
    {
91
        if (!$this->hasDomEvent($domEvent)) {
92
            $this->domEvents[] = $domEvent;
93
        }
94
    }
95
96
    /**
97
     * @param Event $domEvent
98
     */
99
    public function removeDomEvent(Event $domEvent)
100
    {
101
        unset($this->domEvents[array_search($domEvent, $this->domEvents, true)]);
102
    }
103
104
    /**
105
     * @return bool
106
     */
107
    public function hasDomEventsOnce()
108
    {
109
        return !empty($this->domEventsOnce);
110
    }
111
112
    /**
113
     * @return Event[]
114
     */
115
    public function getDomEventsOnce()
116
    {
117
        return $this->domEventsOnce;
118
    }
119
120
    /**
121
     * @param Event[] $domEventsOnce
122
     */
123
    public function setDomEventsOnce(array $domEventsOnce)
124
    {
125
        $this->domEventsOnce = [];
126
        $this->addDomEventsOnce($domEventsOnce);
127
    }
128
129
    /**
130
     * @param Event[] $domEventsOnce
131
     */
132
    public function addDomEventsOnce(array $domEventsOnce)
133
    {
134
        foreach ($domEventsOnce as $domEventOnce) {
135
            $this->addDomEventOnce($domEventOnce);
136
        }
137
    }
138
139
    /**
140
     * @param Event $domEventOnce
141
     *
142
     * @return bool
143
     */
144
    public function hasDomEventOnce(Event $domEventOnce)
145
    {
146
        return in_array($domEventOnce, $this->domEventsOnce, true);
147
    }
148
149
    /**
150
     * @param Event $domEventOnce
151
     */
152
    public function addDomEventOnce(Event $domEventOnce)
153
    {
154
        if (!$this->hasDomEventOnce($domEventOnce)) {
155
            $this->domEventsOnce[] = $domEventOnce;
156
        }
157
    }
158
159
    /**
160
     * @param Event $domEventOnce
161
     */
162
    public function removeDomEventOnce(Event $domEventOnce)
163
    {
164
        unset($this->domEventsOnce[array_search($domEventOnce, $this->domEventsOnce, true)]);
165
    }
166
167
    /**
168
     * @return bool
169
     */
170
    public function hasEvents()
171
    {
172
        return !empty($this->events);
173
    }
174
175
    /**
176
     * @return Event[]
177
     */
178
    public function getEvents()
179
    {
180
        return $this->events;
181
    }
182
183
    /**
184
     * @param Event[] $events
185
     */
186
    public function setEvents(array $events)
187
    {
188
        $this->events = [];
189
        $this->addEvents($events);
190
    }
191
192
    /**
193
     * @param Event[] $events
194
     */
195
    public function addEvents(array $events)
196
    {
197
        foreach ($events as $event) {
198
            $this->addEvent($event);
199
        }
200
    }
201
202
    /**
203
     * @param Event $event
204
     *
205
     * @return bool
206
     */
207
    public function hasEvent(Event $event)
208
    {
209
        return in_array($event, $this->events, true);
210
    }
211
212
    /**
213
     * @param Event $event
214
     */
215
    public function addEvent(Event $event)
216
    {
217
        if (!$this->hasEvent($event)) {
218
            $this->events[] = $event;
219
        }
220
    }
221
222
    /**
223
     * @param Event $event
224
     */
225
    public function removeEvent(Event $event)
226
    {
227
        unset($this->events[array_search($event, $this->events, true)]);
228
    }
229
230
    /**
231
     * @return bool
232
     */
233
    public function hasEventsOnce()
234
    {
235
        return !empty($this->eventsOnce);
236
    }
237
238
    /**
239
     * @return Event[]
240
     */
241
    public function getEventsOnce()
242
    {
243
        return $this->eventsOnce;
244
    }
245
246
    /**
247
     * @param Event[] $eventsOnce
248
     */
249
    public function setEventsOnce(array $eventsOnce)
250
    {
251
        $this->eventsOnce = [];
252
        $this->addEventsOnce($eventsOnce);
253
    }
254
255
    /**
256
     * @param Event[] $eventsOnce
257
     */
258
    public function addEventsOnce(array $eventsOnce)
259
    {
260
        foreach ($eventsOnce as $eventOnce) {
261
            $this->addEventOnce($eventOnce);
262
        }
263
    }
264
265
    /**
266
     * @param Event $eventOnce
267
     *
268
     * @return bool
269
     */
270
    public function hasEventOnce(Event $eventOnce)
271
    {
272
        return in_array($eventOnce, $this->eventsOnce, true);
273
    }
274
275
    /**
276
     * @param Event $eventOnce
277
     */
278
    public function addEventOnce(Event $eventOnce)
279
    {
280
        $this->eventsOnce[] = $eventOnce;
281
    }
282
283
    /**
284
     * @param Event $eventOnce
285
     */
286
    public function removeEventOnce(Event $eventOnce)
287
    {
288
        unset($this->eventsOnce[array_search($eventOnce, $this->eventsOnce, true)]);
289
    }
290
}
291