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
Pull Request — master (#165)
by Eric
05:04 queued 02:32
created

GeocoderResponse   A

Complexity

Total Complexity 12

Size/Duplication

Total Lines 100
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 12
c 1
b 0
f 0
lcom 2
cbo 0
dl 0
loc 100
rs 10

10 Methods

Rating   Name   Duplication   Size   Complexity  
A hasStatus() 0 4 1
A getStatus() 0 4 1
A setStatus() 0 4 1
A hasResults() 0 4 1
A getResults() 0 4 1
A setResults() 0 5 1
A addResults() 0 6 2
A hasResult() 0 4 1
A addResult() 0 6 2
A removeResult() 0 5 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\Service\Geocoder\Response;
13
14
/**
15
 * @author GeLo <[email protected]>
16
 */
17
class GeocoderResponse
18
{
19
    /**
20
     * @var string|null
21
     */
22
    private $status;
23
24
    /**
25
     * @var GeocoderResult[]
26
     */
27
    private $results = [];
28
29
    /**
30
     * @return bool
31
     */
32
    public function hasStatus()
33
    {
34
        return $this->status !== null;
35
    }
36
37
    /**
38
     * @return string|null
39
     */
40
    public function getStatus()
41
    {
42
        return $this->status;
43
    }
44
45
    /**
46
     * @param string|null $status
47
     */
48
    public function setStatus($status = null)
49
    {
50
        $this->status = $status;
51
    }
52
53
    /**
54
     * @return bool
55
     */
56
    public function hasResults()
57
    {
58
        return !empty($this->results);
59
    }
60
61
    /**
62
     * @return GeocoderResult[]
63
     */
64
    public function getResults()
65
    {
66
        return $this->results;
67
    }
68
69
    /**
70
     * @param GeocoderResult[] $results
71
     */
72
    public function setResults(array $results)
73
    {
74
        $this->results = [];
75
        $this->addResults($results);
76
    }
77
78
    /**
79
     * @param GeocoderResult[] $results
80
     */
81
    public function addResults(array $results)
82
    {
83
        foreach ($results as $result) {
84
            $this->addResult($result);
85
        }
86
    }
87
88
    /**
89
     * @param GeocoderResult $result
90
     *
91
     * @return bool
92
     */
93
    public function hasResult(GeocoderResult $result)
94
    {
95
        return in_array($result, $this->results, true);
96
    }
97
98
    /**
99
     * @param GeocoderResult $result
100
     */
101
    public function addResult(GeocoderResult $result)
102
    {
103
        if (!$this->hasResult($result)) {
104
            $this->results[] = $result;
105
        }
106
    }
107
108
    /**
109
     * @param GeocoderResult $result
110
     */
111
    public function removeResult(GeocoderResult $result)
112
    {
113
        unset($this->results[array_search($result, $this->results, true)]);
114
        $this->results = array_values($this->results);
115
    }
116
}
117