DatosAbiertosServiceProvider::boot()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 0
crap 2
1
<?php
2
3
namespace Andreshg112\DatosAbiertos;
4
5
use Illuminate\Support\ServiceProvider;
6
use Andreshg112\DatosAbiertos\Datasets\Colegios;
7
use Andreshg112\DatosAbiertos\Datasets\Divipola;
8
use Andreshg112\DatosAbiertos\Datasets\OrganismosTransito;
9
10
class DatosAbiertosServiceProvider extends ServiceProvider
11
{
12
    /**
13
     * Bootstrap the application services.
14
     */
15 6
    public function boot()
16
    {
17 6
        if ($this->app->runningInConsole()) {
18 6
            $this->publishes([
19 6
                __DIR__ . '/../config/datos-abiertos.php' => config_path('datos-abiertos.php'),
20 6
            ], 'datos-abiertos');
21
        }
22 6
    }
23
24
    /**
25
     * Register the application services.
26
     */
27 6
    public function register()
28
    {
29
        // Automatically apply the package configuration
30 6
        $this->mergeConfigFrom(__DIR__ . '/../config/datos-abiertos.php', 'datos-abiertos');
31
32
        // Register the main class to use with the facade
33
        $this->app->singleton('colegios', function () {
34 2
            return new Colegios;
35 6
        });
36
37
        $this->app->singleton('divipola', function () {
38 2
            return new Divipola;
39 6
        });
40
41
        $this->app->singleton('organismo-transito', function () {
42 2
            return new OrganismosTransito;
43 6
        });
44 6
    }
45
}
46