Skip to content

Commit af2c3e3

Browse files
committed
feat(mapbox): add accuracy to MapboxAddress
1 parent c723cdf commit af2c3e3

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

‎src/Provider/Mapbox/Model/MapboxAddress.php‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ final class MapboxAddress extends Address
5656
*/
5757
private $matchConfidence;
5858

59+
/**
60+
* @var string|null
61+
*/
62+
private $accuracy;
63+
5964
public function withId(?string $id = null): self
6065
{
6166
$new = clone $this;
@@ -174,4 +179,17 @@ public function withMatchConfidence(?string $matchConfidence = null): self
174179

175180
return $new;
176181
}
182+
183+
public function getAccuracy(): ?string
184+
{
185+
return $this->accuracy;
186+
}
187+
188+
public function withAccuracy(?string $accuracy = null): self
189+
{
190+
$new = clone $this;
191+
$new->accuracy = $accuracy;
192+
193+
return $new;
194+
}
177195
}

‎src/Provider/Mapbox/Tests/MapboxAddressTest.php‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,16 @@ public function testMatchConfidence(): void
4242
$this->assertSame('exact', $address->getMatchConfidence());
4343
$this->assertNull($address->withMatchConfidence('exact')->withMatchConfidence()->getMatchConfidence());
4444
}
45+
46+
public function testAccuracy(): void
47+
{
48+
$address = (new AddressBuilder('mapbox'))->build(MapboxAddress::class);
49+
50+
$this->assertNull($address->getAccuracy());
51+
52+
$address = $address->withAccuracy('rooftop');
53+
54+
$this->assertSame('rooftop', $address->getAccuracy());
55+
$this->assertNull($address->withAccuracy('rooftop')->withAccuracy()->getAccuracy());
56+
}
4557
}

0 commit comments

Comments
 (0)