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 (#177)
by Eric
06:31 queued 03:20
created

AddressComponent   A

Complexity

Total Complexity 15

Size/Duplication

Total Lines 129
Duplicated Lines 0 %

Coupling/Cohesion

Components 3
Dependencies 0

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 15
c 1
b 0
f 1
lcom 3
cbo 0
dl 0
loc 129
rs 10

13 Methods

Rating   Name   Duplication   Size   Complexity  
A hasLongName() 0 4 1
A getLongName() 0 4 1
A setLongName() 0 4 1
A hasShortName() 0 4 1
A getShortName() 0 4 1
A setShortName() 0 4 1
A hasTypes() 0 4 1
A getTypes() 0 4 1
A setTypes() 0 5 1
A addTypes() 0 6 2
A hasType() 0 4 1
A addType() 0 6 2
A removeType() 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\Base;
13
14
/**
15
 * @author GeLo <[email protected]>
16
 */
17
class AddressComponent
18
{
19
    /**
20
     * @var string|null
21
     */
22
    private $longName;
23
24
    /**
25
     * @var string|null
26
     */
27
    private $shortName;
28
29
    /**
30
     * @var string[]
31
     */
32
    private $types = [];
33
34
    /**
35
     * @return bool
36
     */
37
    public function hasLongName()
38
    {
39
        return $this->longName !== null;
40
    }
41
42
    /**
43
     * @return string|null
44
     */
45
    public function getLongName()
46
    {
47
        return $this->longName;
48
    }
49
50
    /**
51
     * @param string|null $longName
52
     */
53
    public function setLongName($longName = null)
54
    {
55
        $this->longName = $longName;
56
    }
57
58
    /**
59
     * @return bool
60
     */
61
    public function hasShortName()
62
    {
63
        return $this->shortName !== null;
64
    }
65
66
    /**
67
     * @return string|null
68
     */
69
    public function getShortName()
70
    {
71
        return $this->shortName;
72
    }
73
74
    /**
75
     * @param string|null $shortName
76
     */
77
    public function setShortName($shortName = null)
78
    {
79
        $this->shortName = $shortName;
80
    }
81
82
    /**
83
     * @return bool
84
     */
85
    public function hasTypes()
86
    {
87
        return !empty($this->types);
88
    }
89
90
    /**
91
     * @return string[]
92
     */
93
    public function getTypes()
94
    {
95
        return $this->types;
96
    }
97
98
    /**
99
     * @param string[] $types
100
     */
101
    public function setTypes(array $types)
102
    {
103
        $this->types = [];
104
        $this->addTypes($types);
105
    }
106
107
    /**
108
     * @param string[] $types
109
     */
110
    public function addTypes(array $types)
111
    {
112
        foreach ($types as $type) {
113
            $this->addType($type);
114
        }
115
    }
116
117
    /**
118
     * @param string $type
119
     *
120
     * @return bool
121
     */
122
    public function hasType($type)
123
    {
124
        return in_array($type, $this->types, true);
125
    }
126
127
    /**
128
     * @param string $type
129
     */
130
    public function addType($type)
131
    {
132
        if (!$this->hasType($type)) {
133
            $this->types[] = $type;
134
        }
135
    }
136
137
    /**
138
     * @param string $type
139
     */
140
    public function removeType($type)
141
    {
142
        unset($this->types[array_search($type, $this->types, true)]);
143
        $this->types = array_values($this->types);
144
    }
145
}
146