ServiceProvider::boot()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 18
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 2

Importance

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