Completed
Push — master ( 010a01...d74db1 )
by Tobias
03:10
created

NominatimAddress::getCategory()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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 $osmType;
41
42
    /**
43
     * @var int|null
44
     */
45
    private $osmId;
46
47
    /**
48
     * @var string|null
49
     */
50
    private $type;
51
52
    /**
53
     * @return null|string
54
     */
55 2
    public function getAttribution()
56
    {
57 2
        return $this->attribution;
58
    }
59
60
    /**
61
     * @param null|string $attribution
62
     *
63
     * @return NominatimAddress
64
     */
65 6
    public function withAttribution(string $attribution = null): self
66
    {
67 6
        $new = clone $this;
68 6
        $new->attribution = $attribution;
69
70 6
        return $new;
71
    }
72
73
    /**
74
     * @deprecated
75
     *
76
     * @return null|string
77
     */
78
    public function getClass()
79
    {
80
        return $this->getCategory();
81
    }
82
83
    /**
84
     * @deprecated
85
     *
86
     * @param null|string $category
87
     *
88
     * @return NominatimAddress
89
     */
90
    public function withClass(string $category = null): self
91
    {
92
        return $this->withCategory($category);
93
    }
94
95
    /**
96
     * @return null|string
97
     */
98 2
    public function getCategory()
99
    {
100 2
        return $this->category;
101
    }
102
103
    /**
104
     * @param null|string $category
105
     *
106
     * @return NominatimAddress
107
     */
108 4
    public function withCategory(string $category = null): self
109
    {
110 4
        $new = clone $this;
111 4
        $new->category = $category;
112
113 4
        return $new;
114
    }
115
116
    /**
117
     * @return null|string
118
     */
119 2
    public function getDisplayName()
120
    {
121 2
        return $this->displayName;
122
    }
123
124
    /**
125
     * @param null|string $displayName
126
     *
127
     * @return NominatimAddress
128
     */
129 6
    public function withDisplayName(string $displayName = null): self
130
    {
131 6
        $new = clone $this;
132 6
        $new->displayName = $displayName;
133
134 6
        return $new;
135
    }
136
137
    /**
138
     * @return null|int
139
     */
140 2
    public function getOSMId()
141
    {
142 2
        return $this->osmId;
143
    }
144
145
    /**
146
     * @param null|int $osmId
147
     *
148
     * @return NominatimAddress
149
     */
150 6
    public function withOSMId(int $osmId = null): self
151
    {
152 6
        $new = clone $this;
153 6
        $new->osmId = $osmId;
154
155 6
        return $new;
156
    }
157
158
    /**
159
     * @return null|string
160
     */
161 2
    public function getOSMType()
162
    {
163 2
        return $this->osmType;
164
    }
165
166
    /**
167
     * @param null|string $osmType
168
     *
169
     * @return NominatimAddress
170
     */
171 6
    public function withOSMType(string $osmType = null): self
172
    {
173 6
        $new = clone $this;
174 6
        $new->osmType = $osmType;
175
176 6
        return $new;
177
    }
178
179
    /**
180
     * @return null|string
181
     */
182 2
    public function getType()
183
    {
184 2
        return $this->type;
185
    }
186
187
    /**
188
     * @param null|string $type
189
     *
190
     * @return NominatimAddress
191
     */
192 4
    public function withType(string $type = null): self
193
    {
194 4
        $new = clone $this;
195 4
        $new->type = $type;
196
197 4
        return $new;
198
    }
199
}
200