OpenFoodFactsServiceProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 3
dl 0
loc 20
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 8 2
A register() 0 8 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