OpenFoodFactsServiceProvider::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 Palmans\LaravelOpenFoodFacts;
4
5
use Illuminate\Contracts\Container\Container;
6
use Illuminate\Support\ServiceProvider;
7
8
class OpenFoodFactsServiceProvider extends ServiceProvider
9
{
10 8
    public function boot()
11
    {
12 8
        if ($this->app->runningInConsole()) {
13 8
            $this->publishes([
14 8
                __DIR__.'/../config/openfoodfacts.php' => config_path('openfoodfacts.php'),
15 8
            ], 'config');
16
        }
17 8
    }
18
19 8
    public function register()
20
    {
21 8
        $this->mergeConfigFrom(__DIR__.'/../config/openfoodfacts.php', 'openfoodfacts');
22
23
        $this->app->singleton('openfoodfacts', function (Container $app) {
24 8
            return new OpenFoodFacts($app);
25 8
        });
26 8
    }
27
}
28