Skip to content

Commit d9cccd3

Browse files
committedOct 2, 2019
Inject logger into chain provider.
1 parent c48a0ba commit d9cccd3

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed
 

‎src/ProviderAndDumperAggregator.php

+7-3
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@
1818
use Geocoder\ProviderAggregator;
1919
use Geocoder\Query\GeocodeQuery;
2020
use Geocoder\Query\ReverseQuery;
21+
use Illuminate\Log\Logger;
2122
use Illuminate\Support\Collection;
2223
use Illuminate\Support\Str;
24+
use Psr\Log\LoggerAwareTrait;
2325
use ReflectionClass;
2426

2527
/**
@@ -246,11 +248,13 @@ protected function getProvidersFromConfiguration(Collection $providers) : array
246248
$arguments = $this->getArguments($arguments, $provider);
247249
$reflection = new ReflectionClass($provider);
248250

249-
if ($provider === 'Geocoder\Provider\Chain\Chain') {
251+
if ($provider === "Geocoder\Provider\Chain\Chain") {
250252
$chainProvider = $reflection->newInstance($arguments);
251253

252-
if (in_array(\Psr\Log\LoggerAwareTrait::class, class_uses($chainProvider)) && app(\Illuminate\Log\Logger::class) !== null) {
253-
$chainProvider->setLogger(app(\Illuminate\Log\Logger::class));
254+
if (in_array(LoggerAwareTrait::class, class_uses($chainProvider))
255+
&& app(Logger::class) !== null
256+
) {
257+
$chainProvider->setLogger(app(Logger::class));
254258
}
255259

256260
return $chainProvider;

0 commit comments

Comments
 (0)
Please sign in to comment.