TcmbServiceProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 15
dl 0
loc 28
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 17 2
A register() 0 5 1
1
<?php
2
3
namespace Elvendor\Tcmb;
4
5
use Illuminate\Support\ServiceProvider;
6
use Elvendor\Tcmb\Commands\SyncRatesCommand;
7
8
class TcmbServiceProvider extends ServiceProvider
9
{
10
    public function boot()
11
    {
12
        $this->loadMigrationsFrom(__DIR__.'/../database/migrations');
13
        $this->loadRoutesFrom(__DIR__.'/routes.php');
14
15
        if ($this->app->runningInConsole()) {
16
            
17
            $this->publishes([
18
                __DIR__.'/../config/config.php' => config_path('tcmb.php'),
19
            ], 'config');
20
21
            $this->publishes([
22
                __DIR__.'/../database/migrations/' => database_path('migrations')
23
            ], 'migrations');
24
25
            $this->commands([
26
                SyncRatesCommand::class
27
            ]);
28
        }
29
    }
30
31
    public function register()
32
    {
33
        $this->mergeConfigFrom(__DIR__.'/../config/config.php', 'tcmb');
34
        $this->app->singleton('tcmb', function () {
35
            return new Tcmb;
36
        });
37
    }
38
}
39