Completed
Push — master ( fef860...0ac8a8 )
by Tobias
03:53
created

OpenCageAddress::getGeohash()   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\OpenCage\Model;
14
15
use Geocoder\Model\Address;
16
17
final class OpenCageAddress extends Address
18
{
19
    /**
20
     * @var string|null
21
     *
22
     * @see https://en.wikipedia.org/wiki/Military_Grid_Reference_System
23
     */
24
    private $mgrs;
25
26
    /**
27
     * @var string|null
28
     *
29
     * @see https://en.wikipedia.org/wiki/Maidenhead_Locator_System
30
     */
31
    private $maidenhead;
32
33
    /**
34
     * @var string|null
35
     *
36
     * @see https://en.wikipedia.org/wiki/Geohash
37
     */
38
    private $geohash;
39
40
    /**
41
     * @var string|null
42
     *
43
     * @see https://what3words.com/
44
     */
45
    private $what3words;
46
47
    /**
48
     * @var string|null
49
     */
50
    private $formattedAddress;
51
52
    /**
53
     * @param null|string $mgrs
54
     *
55
     * @return OpenCageAddress
56
     */
57 8
    public function withMGRS(string $mgrs = null): self
58
    {
59 8
        $new = clone $this;
60 8
        $new->mgrs = $mgrs;
61
62 8
        return $new;
63
    }
64
65
    /**
66
     * @return null|string
67
     */
68 2
    public function getMGRS()
69
    {
70 2
        return $this->mgrs;
71
    }
72
73
    /**
74
     * @param null|string $maidenhead
75
     *
76
     * @return OpenCageAddress
77
     */
78 8
    public function withMaidenhead(string $maidenhead = null): self
79
    {
80 8
        $new = clone $this;
81 8
        $new->maidenhead = $maidenhead;
82
83 8
        return $new;
84
    }
85
86
    /**
87
     * @return null|string
88
     */
89 2
    public function getMaidenhead()
90
    {
91 2
        return $this->maidenhead;
92
    }
93
94
    /**
95
     * @param null|string $geohash
96
     *
97
     * @return OpenCageAddress
98
     */
99 8
    public function withGeohash(string $geohash = null): self
100
    {
101 8
        $new = clone $this;
102 8
        $new->geohash = $geohash;
103
104 8
        return $new;
105
    }
106
107
    /**
108
     * @return null|string
109
     */
110 2
    public function getGeohash()
111
    {
112 2
        return $this->geohash;
113
    }
114
115
    /**
116
     * @param null|string $what3words
117
     *
118
     * @return OpenCageAddress
119
     */
120 8
    public function withWhat3words(string $what3words = null): self
121
    {
122 8
        $new = clone $this;
123 8
        $new->what3words = $what3words;
124
125 8
        return $new;
126
    }
127
128
    /**
129
     * @return null|string
130
     */
131 2
    public function getWhat3words()
132
    {
133 2
        return $this->what3words;
134
    }
135
136
    /**
137
     * @param string|null $formattedAddress
138
     *
139
     * @return OpenCageAddress
140
     */
141 8
    public function withFormattedAddress(string $formattedAddress = null): self
142
    {
143 8
        $new = clone $this;
144 8
        $new->formattedAddress = $formattedAddress;
145
146 8
        return $new;
147
    }
148
149
    /**
150
     * @return null|string
151
     */
152 2
    public function getFormattedAddress()
153
    {
154 2
        return $this->formattedAddress;
155
    }
156
}
157