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 — symbol ( 74f22f )
by Eric
63:49
created

Polyline   A

Complexity

Total Complexity 17

Size/Duplication

Total Lines 149
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 2

Importance

Changes 0
Metric Value
wmc 17
lcom 2
cbo 2
dl 0
loc 149
rs 10
c 0
b 0
f 0

15 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A hasCoordinates() 0 4 1
A getCoordinates() 0 4 1
A setCoordinates() 0 5 1
A addCoordinates() 0 6 2
A hasCoordinate() 0 4 1
A addCoordinate() 0 4 1
A removeCoordinate() 0 4 1
A hasIconSequences() 0 4 1
A getIconSequences() 0 4 1
A setIconSequences() 0 5 1
A addIconSequences() 0 6 2
A hasIconSequence() 0 4 1
A addIconSequence() 0 4 1
A removeIconSequence() 0 4 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\Overlay;
13
14
use Ivory\GoogleMap\Base\Coordinate;
15
use Ivory\GoogleMap\Utility\OptionsAwareInterface;
16
use Ivory\GoogleMap\Utility\OptionsAwareTrait;
17
use Ivory\GoogleMap\Utility\VariableAwareTrait;
18
19
/**
20
 * @see http://code.google.com/apis/maps/documentation/javascript/reference.html#Polyline
21
 *
22
 * @author GeLo <[email protected]>
23
 */
24
class Polyline implements ExtendableInterface, OptionsAwareInterface
25
{
26
    use OptionsAwareTrait;
27
    use VariableAwareTrait;
28
29
    /**
30
     * @var Coordinate[]
31
     */
32
    private $coordinates = [];
33
34
    /**
35
     * @var IconSequence[]
36
     */
37
    private $iconSequences = [];
38
39
    /**
40
     * @param Coordinate[]   $coordinates
41
     * @param IconSequence[] $icons
42
     * @param mixed[]        $options
43
     */
44
    public function __construct(array $coordinates = [], array $icons = [], array $options = [])
45
    {
46
        $this->addCoordinates($coordinates);
47
        $this->addIconSequences($icons);
48
        $this->addOptions($options);
49
    }
50
51
    /**
52
     * @return bool
53
     */
54
    public function hasCoordinates()
55
    {
56
        return !empty($this->coordinates);
57
    }
58
59
    /**
60
     * @return Coordinate[]
61
     */
62
    public function getCoordinates()
63
    {
64
        return $this->coordinates;
65
    }
66
67
    /**
68
     * @param Coordinate[] $coordinates
69
     */
70
    public function setCoordinates($coordinates)
71
    {
72
        $this->coordinates = [];
73
        $this->addCoordinates($coordinates);
74
    }
75
76
    /**
77
     * @param Coordinate[] $coordinates
78
     */
79
    public function addCoordinates($coordinates)
80
    {
81
        foreach ($coordinates as $coordinate) {
82
            $this->addCoordinate($coordinate);
83
        }
84
    }
85
86
    /**
87
     * @param Coordinate $coordinate
88
     *
89
     * @return bool
90
     */
91
    public function hasCoordinate(Coordinate $coordinate)
92
    {
93
        return in_array($coordinate, $this->coordinates, true);
94
    }
95
96
    /**
97
     * @param Coordinate $coordinate
98
     */
99
    public function addCoordinate(Coordinate $coordinate)
100
    {
101
        $this->coordinates[] = $coordinate;
102
    }
103
104
    /**
105
     * @param Coordinate $coordinate
106
     */
107
    public function removeCoordinate(Coordinate $coordinate)
108
    {
109
        unset($this->coordinates[array_search($coordinate, $this->coordinates, true)]);
110
    }
111
112
    /**
113
     * @return bool
114
     */
115
    public function hasIconSequences()
116
    {
117
        return !empty($this->iconSequences);
118
    }
119
120
    /**
121
     * @return IconSequence[]
122
     */
123
    public function getIconSequences()
124
    {
125
        return $this->iconSequences;
126
    }
127
128
    /**
129
     * @param IconSequence[] $iconSequences
130
     */
131
    public function setIconSequences($iconSequences)
132
    {
133
        $this->iconSequences = [];
134
        $this->addIconSequences($iconSequences);
135
    }
136
137
    /**
138
     * @param IconSequence[] $iconSequences
139
     */
140
    public function addIconSequences($iconSequences)
141
    {
142
        foreach ($iconSequences as $iconSequence) {
143
            $this->addIconSequence($iconSequence);
144
        }
145
    }
146
147
    /**
148
     * @param IconSequence $iconSequence
149
     *
150
     * @return bool
151
     */
152
    public function hasIconSequence(IconSequence $iconSequence)
153
    {
154
        return in_array($iconSequence, $this->iconSequences, true);
155
    }
156
157
    /**
158
     * @param IconSequence $iconSequence
159
     */
160
    public function addIconSequence(IconSequence $iconSequence)
161
    {
162
        $this->iconSequences[] = $iconSequence;
163
    }
164
165
    /**
166
     * @param IconSequence $iconSequence
167
     */
168
    public function removeIconSequence(IconSequence $iconSequence)
169
    {
170
        unset($this->iconSequences[array_search($iconSequence, $this->iconSequences, true)]);
171
    }
172
}
173