Completed
Branch master (6c9e1c)
by Mike
02:15
created

GeocoderService::provides()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php namespace Geocoder\Laravel\Providers;
2
3
/**
4
 * This file is part of the Geocoder Laravel package.
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 *
8
 * @author Mike Bronner <[email protected]>
9
 * @license    MIT License
10
 */
11
12
use Geocoder\Laravel\Facades\Geocoder;
13
use Geocoder\Laravel\ProviderAndDumperAggregator;
14
use Illuminate\Support\Collection;
15
use Illuminate\Support\ServiceProvider;
16
use ReflectionClass;
17
18
class GeocoderService extends ServiceProvider
19
{
20
    protected $defer = false;
21
22 21
    public function boot()
23
    {
24 21
        $configPath = __DIR__ . '/../../config/geocoder.php';
25 21
        $this->publishes([$configPath => config_path('geocoder.php')], 'config');
26 21
        $this->mergeConfigFrom($configPath, 'geocoder');
27 21
        $this->app->singleton('geocoder', function () {
28 19
            return (new ProviderAndDumperAggregator)->registerProvidersFromConfig(collect(config('geocoder.providers')));
29 21
        });
30 21
    }
31
32 21
    public function register()
33
    {
34 21
        $this->app->alias('Geocoder', Geocoder::class);
35 21
    }
36
37
    public function provides() : array
38
    {
39
        return ['geocoder'];
40
    }
41
}
42