Completed
Push — master ( 80f39c...076a68 )
by Tobias
01:26
created

NominatimAddress::withCategory()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Geocoder package.
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * @license    MIT License
11
 */
12
13
namespace Geocoder\Provider\Nominatim\Model;
14
15
use Geocoder\Model\Address;
16
17
/**
18
 * @author Jonathan Beliën <[email protected]>
19
 */
20
final class NominatimAddress extends Address
21
{
22
    /**
23
     * @var string|null
24
     */
25
    private $attribution;
26
27
    /**
28
     * @var string|null
29
     */
30
    private $category;
31
32
    /**
33
     * @var string|null
34
     */
35
    private $displayName;
36
37
    /**
38
     * @var string|null
39
     */
40
    private $quarter;
41
42
    /**
43
     * @var string|null
44
     */
45
    private $osmType;
46
47
    /**
48
     * @var int|null
49
     */
50
    private $osmId;
51
52
    /**
53
     * @var string|null
54
     */
55
    private $type;
56
57
    /**
58
     * @return string|null
59
     */
60 4
    public function getAttribution()
61
    {
62 4
        return $this->attribution;
63
    }
64
65
    /**
66
     * @param string|null $attribution
67
     *
68
     * @return NominatimAddress
69
     */
70 9
    public function withAttribution(string $attribution = null): self
71
    {
72 9
        $new = clone $this;
73 9
        $new->attribution = $attribution;
74
75 9
        return $new;
76
    }
77
78
    /**
79
     * @deprecated
80
     *
81
     * @return string|null
82
     */
83
    public function getClass()
84
    {
85
        return $this->getCategory();
86
    }
87
88
    /**
89
     * @deprecated
90
     *
91
     * @param string|null $category
92
     *
93
     * @return NominatimAddress
94
     */
95
    public function withClass(string $category = null): self
96
    {
97
        return $this->withCategory($category);
98
    }
99
100
    /**
101
     * @return string|null
102
     */
103 4
    public function getCategory()
104
    {
105 4
        return $this->category;
106
    }
107
108
    /**
109
     * @param string|null $category
110
     *
111
     * @return NominatimAddress
112
     */
113 7
    public function withCategory(string $category = null): self
114
    {
115 7
        $new = clone $this;
116 7
        $new->category = $category;
117
118 7
        return $new;
119
    }
120
121
    /**
122
     * @return string|null
123
     */
124 3
    public function getDisplayName()
125
    {
126 3
        return $this->displayName;
127
    }
128
129
    /**
130
     * @param string|null $displayName
131
     *
132
     * @return NominatimAddress
133
     */
134 9
    public function withDisplayName(string $displayName = null): self
135
    {
136 9
        $new = clone $this;
137 9
        $new->displayName = $displayName;
138
139 9
        return $new;
140
    }
141
142
    /**
143
     * @return int|null
144
     */
145 4
    public function getOSMId()
146
    {
147 4
        return $this->osmId;
148
    }
149
150
    /**
151
     * @param int|null $osmId
152
     *
153
     * @return NominatimAddress
154
     */
155 8
    public function withOSMId(int $osmId = null): self
156
    {
157 8
        $new = clone $this;
158 8
        $new->osmId = $osmId;
159
160 8
        return $new;
161
    }
162
163
    /**
164
     * @return string|null
165
     */
166 4
    public function getOSMType()
167
    {
168 4
        return $this->osmType;
169
    }
170
171
    /**
172
     * @param string|null $osmType
173
     *
174
     * @return NominatimAddress
175
     */
176 8
    public function withOSMType(string $osmType = null): self
177
    {
178 8
        $new = clone $this;
179 8
        $new->osmType = $osmType;
180
181 8
        return $new;
182
    }
183
184
    /**
185
     * @return string|null
186
     */
187 3
    public function getType()
188
    {
189 3
        return $this->type;
190
    }
191
192
    /**
193
     * @param string|null $type
194
     *
195
     * @return NominatimAddress
196
     */
197 7
    public function withType(string $type = null): self
198
    {
199 7
        $new = clone $this;
200 7
        $new->type = $type;
201
202 7
        return $new;
203
    }
204
205
    /**
206
     * @return string|null
207
     */
208 1
    public function getQuarter(): ?string
209
    {
210 1
        return $this->quarter;
211
    }
212
213
    /**
214
     * @param string|null $quarter
215
     *
216
     * @return NominatimAddress
217
     */
218 1
    public function withQuarter(string $quarter = null): self
219
    {
220 1
        $new = clone $this;
221 1
        $new->quarter = $quarter;
222
223 1
        return $new;
224
    }
225
}
226