Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 640efaf

Browse files
Allow locale change with chain
Fix coding standards Prevent logical error #408 (comment)
1 parent b275620 commit 640efaf

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Geocoder/Provider/Chain.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@
1616
/**
1717
* @author Markus Bachmann <[email protected]>
1818
*/
19-
class Chain implements Provider
19+
class Chain implements LocaleAwareProvider
2020
{
21+
use LocaleTrait;
22+
2123
/**
2224
* @var Provider[]
2325
*/
@@ -38,6 +40,10 @@ public function geocode($address)
3840
{
3941
$exceptions = [];
4042
foreach ($this->providers as $provider) {
43+
if ($provider instanceof LocaleAwareProvider && $this->getLocale() !== null){
44+
$provider = clone $provider;
45+
$provider->setLocale($this->getLocale());
46+
}
4147
try {
4248
return $provider->geocode($address);
4349
} catch (InvalidCredentials $e) {

0 commit comments

Comments
 (0)