ZabbixGraphServiceProvider::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 CasperBoone\LaravelZabbixGraph;
4
5
use Illuminate\Support\ServiceProvider;
6
use CasperBoone\ZabbixGraph\ZabbixGraph;
7
8
class ZabbixGraphServiceProvider extends ServiceProvider
9
{
10
    /**
11
     * Bootstrap the application services.
12
     */
13 2
    public function boot()
14
    {
15 2
        if ($this->app->runningInConsole()) {
16 2
            $this->publishes([
17 2
                __DIR__.'/../config/zabbixgraph.php' => config_path('zabbixgraph.php'),
18 2
            ], 'config');
19
        }
20 2
    }
21
22
    /**
23
     * Register the application services.
24
     */
25 2
    public function register()
26
    {
27 2
        $this->mergeConfigFrom(__DIR__.'/../config/zabbixgraph.php', 'zabbixgraph');
28
29 2
        $this->app->bind(ZabbixGraph::class, function () {
30 2
            return new ZabbixGraph(
31 2
                $this->app['config']['zabbixgraph.host'],
32 2
                $this->app['config']['zabbixgraph.username'],
33 2
                $this->app['config']['zabbixgraph.password'],
34 2
                $this->app['config']['zabbixgraph.old_version']
35
            );
36 2
        });
37 2
    }
38
}
39