Skip to content

Commit c723cdf

Browse files
committed
feat(mapbox): add matchConfidence to MapboxAddress
1 parent 7ec7d33 commit c723cdf

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
@@ -51,6 +51,11 @@ final class MapboxAddress extends Address
5151
*/
5252
private $matchCode;
5353

54+
/**
55+
* @var string|null
56+
*/
57+
private $matchConfidence;
58+
5459
public function withId(?string $id = null): self
5560
{
5661
$new = clone $this;
@@ -156,4 +161,17 @@ public function withMatchCode(?array $matchCode = null): self
156161

157162
return $new;
158163
}
164+
165+
public function getMatchConfidence(): ?string
166+
{
167+
return $this->matchConfidence;
168+
}
169+
170+
public function withMatchConfidence(?string $matchConfidence = null): self
171+
{
172+
$new = clone $this;
173+
$new->matchConfidence = $matchConfidence;
174+
175+
return $new;
176+
}
159177
}

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,16 @@ public function testMatchCode(): void
3030
$this->assertSame($matchCode, $address->getMatchCode());
3131
$this->assertNull($address->withMatchCode($matchCode)->withMatchCode()->getMatchCode());
3232
}
33+
34+
public function testMatchConfidence(): void
35+
{
36+
$address = (new AddressBuilder('mapbox'))->build(MapboxAddress::class);
37+
38+
$this->assertNull($address->getMatchConfidence());
39+
40+
$address = $address->withMatchConfidence('exact');
41+
42+
$this->assertSame('exact', $address->getMatchConfidence());
43+
$this->assertNull($address->withMatchConfidence('exact')->withMatchConfidence()->getMatchConfidence());
44+
}
3345
}

0 commit comments

Comments
 (0)