OpenFoodFactsServiceProvider::register()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

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