File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,6 +46,11 @@ final class MapboxAddress extends Address
4646 */
4747 private $ neighborhood ;
4848
49+ /**
50+ * @var array<string, mixed>|null
51+ */
52+ private $ matchCode ;
53+
4954 public function withId (?string $ id = null ): self
5055 {
5156 $ new = clone $ this ;
@@ -132,4 +137,23 @@ public function withNeighborhood(?string $neighborhood = null): self
132137
133138 return $ new ;
134139 }
140+
141+ /**
142+ * @return array<string, mixed>|null
143+ */
144+ public function getMatchCode (): ?array
145+ {
146+ return $ this ->matchCode ;
147+ }
148+
149+ /**
150+ * @param array<string, mixed>|null $matchCode
151+ */
152+ public function withMatchCode (?array $ matchCode = null ): self
153+ {
154+ $ new = clone $ this ;
155+ $ new ->matchCode = $ matchCode ;
156+
157+ return $ new ;
158+ }
135159}
Original file line number Diff line number Diff line change 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 \Mapbox \Tests ;
14+
15+ use Geocoder \Model \AddressBuilder ;
16+ use Geocoder \Provider \Mapbox \Model \MapboxAddress ;
17+ use PHPUnit \Framework \TestCase ;
18+
19+ class MapboxAddressTest extends TestCase
20+ {
21+ public function testMatchCode (): void
22+ {
23+ $ address = (new AddressBuilder ('mapbox ' ))->build (MapboxAddress::class);
24+
25+ $ this ->assertNull ($ address ->getMatchCode ());
26+
27+ $ matchCode = ['street ' => 'matched ' , 'confidence ' => 'exact ' ];
28+ $ address = $ address ->withMatchCode ($ matchCode );
29+
30+ $ this ->assertSame ($ matchCode , $ address ->getMatchCode ());
31+ $ this ->assertNull ($ address ->withMatchCode ($ matchCode )->withMatchCode ()->getMatchCode ());
32+ }
33+ }
You can’t perform that action at this time.
0 commit comments