Passed
Push — master ( e889f2...0c6ae7 )
by Yaroslav
20:05 queued 10s
created

ServiceProvider::boot()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 16
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 9
c 1
b 0
f 0
nc 2
nop 0
dl 0
loc 16
ccs 9
cts 9
cp 1
crap 2
rs 9.9666
1
<?php
2
3
namespace LaraGeoData;
4
5
use LaraGeoData\Console\Commands\DownloadFilesCommand;
6
use LaraGeoData\Console\Commands\DownloadTruncateCommand;
7
8
class ServiceProvider extends \Illuminate\Support\ServiceProvider
9
{
10 2
    public function boot()
11
    {
12 2
        if ($this->app->runningInConsole()) {
13 2
            $this->publishes([
14 2
                __DIR__ . '/../config/geonames.php' => config_path('geonames.php'),
15 2
            ], 'config');
16
17
18 2
            $this->commands([
19 2
                DownloadFilesCommand::class,
20
                DownloadTruncateCommand::class,
21
            ]);
22
        }
23
24 2
        $this->app->bind('geodata-importer', function ($app) {
25 2
            return new GeoDataImporter($app);
26 2
        });
27 2
    }
28
29
    /**
30
     * @inheritDoc
31
     */
32 2
    public function register()
33
    {
34 2
        $this->mergeConfigFrom(__DIR__ . '/../config/geonames.php', 'geonames');
35 2
    }
36
}
37