Skip to content

Commit 1cd8657

Browse files
committed
Format PR changes
1 parent eabbf2a commit 1cd8657

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ app('geocoder')->reverse(43.882587,-103.454067)->get();
234234
app('geocoder')->geocode('Los Angeles, CA')->dump('kml');
235235
```
236236

237-
#### Using Controller
237+
#### Dependency Injection
238238
```php
239239
use Geocoder\Laravel\ProviderAndDumperAggregator as Geocoder;
240240

src/Providers/GeocoderService.php

+10-13
Original file line numberDiff line numberDiff line change
@@ -25,30 +25,27 @@ public function boot()
2525
"config"
2626
);
2727
$this->mergeConfigFrom($configPath, "geocoder");
28-
29-
$providerAndDumperAggregator = (new ProviderAndDumperAggregator)
28+
$geocoder = (new ProviderAndDumperAggregator)
3029
->registerProvidersFromConfig(collect(config("geocoder.providers")));
31-
32-
$this->app->singleton("geocoder", function ($app) use ($providerAndDumperAggregator) {
33-
return $providerAndDumperAggregator;
34-
});
35-
36-
// Resolve dependency via class name
37-
// i.e app(ProviderAndDumperAggregator::class) or _construct(ProviderAndDumperAggregator $geocoder)
38-
$this->app->instance(ProviderAndDumperAggregator::class, $providerAndDumperAggregator);
30+
$this->app
31+
->singleton("geocoder", function () use ($geocoder) {
32+
return $geocoder;
33+
});
34+
$this->app
35+
->instance(ProviderAndDumperAggregator::class, $geocoder);
3936
}
4037

4138
public function register()
4239
{
4340
$this->app->alias("Geocoder", Geocoder::class);
4441
}
4542

46-
public function provides(): array
43+
public function provides() : array
4744
{
48-
return ["geocoder"];
45+
return ["geocoder", ProviderAndDumperAggregator::class];
4946
}
5047

51-
protected function configPath(string $path = ""): string
48+
protected function configPath(string $path = "") : string
5249
{
5350
if (function_exists("config_path")) {
5451
return config_path($path);

0 commit comments

Comments
 (0)