Completed
Push — master ( 10ef6a...00d296 )
by Mike
04:44
created

GeocoderService   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 85.71%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 3
dl 0
loc 25
ccs 12
cts 14
cp 0.8571
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 10 1
A register() 0 4 1
A provides() 0 4 1
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)
29 19
            	->registerProvidersFromConfig(collect(config('geocoder.providers')));
30 21
        });
31 21
    }
32
33 21
    public function register()
34
    {
35 21
        $this->app->alias('Geocoder', Geocoder::class);
36 21
    }
37
38
    public function provides() : array
39
    {
40
        return ['geocoder'];
41
    }
42
}
43