Passed
Push — master ( 39e5a8...610dd1 )
by Yaroslav
03:43
created

ServiceProvider::boot()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 17
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 2

Importance

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