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 — geocoder ( aa3a17 )
by Eric
02:27
created

AbstractGeocoderReverseRequest   A

Complexity

Total Complexity 21

Size/Duplication

Total Lines 158
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 21
c 1
b 0
f 1
lcom 1
cbo 1
dl 0
loc 158
rs 10

15 Methods

Rating   Name   Duplication   Size   Complexity  
A hasResultTypes() 0 4 1
A getResultTypes() 0 4 1
A setResultTypes() 0 5 1
A addResultTypes() 0 6 2
A hasResultType() 0 4 1
A addResultType() 0 6 2
A removeResultType() 0 5 1
A hasLocationTypes() 0 4 1
A getLocationTypes() 0 4 1
A setLocationTypes() 0 5 1
A addLocationTypes() 0 6 2
A hasLocationType() 0 4 1
A addLocationType() 0 6 2
A removeLocationType() 0 5 1
A buildQuery() 0 14 3
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\Service\Geocoder;
13
14
/**
15
 * @see http://code.google.com/apis/maps/documentation/javascript/reference.html#GeocoderRequest
16
 *
17
 * @author GeLo <[email protected]>
18
 */
19
abstract class AbstractGeocoderReverseRequest extends AbstractGeocoderRequest
20
{
21
    /**
22
     * @var string[]
23
     */
24
    private $resultTypes = [];
25
26
    /**
27
     * @var string[]
28
     */
29
    private $locationTypes = [];
30
31
    /**
32
     * @return bool
33
     */
34
    public function hasResultTypes()
35
    {
36
        return !empty($this->resultTypes);
37
    }
38
39
    /**
40
     * @return string[]
41
     */
42
    public function getResultTypes()
43
    {
44
        return $this->resultTypes;
45
    }
46
47
    /**
48
     * @param string[] $resultTypes
49
     */
50
    public function setResultTypes(array $resultTypes)
51
    {
52
        $this->resultTypes = [];
53
        $this->addResultTypes($resultTypes);
54
    }
55
56
    /**
57
     * @param string[] $resultTypes
58
     */
59
    public function addResultTypes(array $resultTypes)
60
    {
61
        foreach ($resultTypes as $resultType) {
62
            $this->addResultType($resultType);
63
        }
64
    }
65
66
    /**
67
     * @param string $resultType
68
     *
69
     * @return bool
70
     */
71
    public function hasResultType($resultType)
72
    {
73
        return in_array($resultType, $this->resultTypes, true);
74
    }
75
76
    /**
77
     * @param string $resultType
78
     */
79
    public function addResultType($resultType)
80
    {
81
        if (!$this->hasResultType($resultType)) {
82
            $this->resultTypes[] = $resultType;
83
        }
84
    }
85
86
    /**
87
     * @param string $resultType
88
     */
89
    public function removeResultType($resultType)
90
    {
91
        unset($this->resultTypes[array_search($resultType, $this->resultTypes, true)]);
92
        $this->resultTypes = array_values($this->resultTypes);
93
    }
94
95
    /**
96
     * @return bool
97
     */
98
    public function hasLocationTypes()
99
    {
100
        return !empty($this->locationTypes);
101
    }
102
103
    /**
104
     * @return string[]
105
     */
106
    public function getLocationTypes()
107
    {
108
        return $this->locationTypes;
109
    }
110
111
    /**
112
     * @param string[] $locationTypes
113
     */
114
    public function setLocationTypes(array $locationTypes)
115
    {
116
        $this->locationTypes = [];
117
        $this->addLocationTypes($locationTypes);
118
    }
119
120
    /**
121
     * @param string[] $locationTypes
122
     */
123
    public function addLocationTypes(array $locationTypes)
124
    {
125
        foreach ($locationTypes as $locationType) {
126
            $this->addLocationType($locationType);
127
        }
128
    }
129
130
    /**
131
     * @param string $locationType
132
     *
133
     * @return bool
134
     */
135
    public function hasLocationType($locationType)
136
    {
137
        return in_array($locationType, $this->locationTypes, true);
138
    }
139
140
    /**
141
     * @param string $locationType
142
     */
143
    public function addLocationType($locationType)
144
    {
145
        if (!$this->hasLocationType($locationType)) {
146
            $this->locationTypes[] = $locationType;
147
        }
148
    }
149
150
    /**
151
     * @param string $locationType
152
     */
153
    public function removeLocationType($locationType)
154
    {
155
        unset($this->locationTypes[array_search($locationType, $this->locationTypes, true)]);
156
        $this->locationTypes = array_values($this->locationTypes);
157
    }
158
159
    /**
160
     * {@inheritdoc}
161
     */
162
    public function buildQuery()
163
    {
164
        $query = [];
165
166
        if ($this->hasResultTypes()) {
167
            $query['result_type'] = implode('|', $this->resultTypes);
168
        }
169
170
        if ($this->hasLocationTypes()) {
171
            $query['location_type'] = implode('|', $this->locationTypes);
172
        }
173
174
        return array_merge(parent::buildQuery(), $query);
175
    }
176
}
177