DatosAbiertosServiceProvider::register()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 18

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 18
ccs 9
cts 9
cp 1
rs 9.6666
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
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