GtinServiceProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
c 1
b 0
f 0
dl 0
loc 27
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 9 1
A boot() 0 9 2
1
<?php declare(strict_types=1);
2
3
namespace JustSteveKing\GtinPHP\Providers;
4
5
use Illuminate\Support\ServiceProvider;
6
use Illuminate\Validation\Rule;
7
use JustSteveKing\GtinPHP\Gtin;
8
9
class GtinServiceProvider extends ServiceProvider
10
{
11
    /**
12
     * Boot the package
13
     *
14
     * @return void
15
     */
16
    public function boot()
17
    {
18
        if ($this->app->runningInConsole()) {
19
            $this->publishes([
20
                __DIR__ . '/../../config/gtin.php' => config_path('gtin.php'),
21
            ], 'config');
22
        }
23
24
        $this->app->singleton('gtin', Gtin::class);
25
    }
26
27
    public function register()
28
    {
29
        $this->mergeConfigFrom(
30
            __DIR__ . '/../../config/gtin.php',
31
            'gtin'
32
        );
33
34
        Rule::macro('gtin', function () {
35
            return new \JustSteveKing\GtinPHP\Rules\Gtin;
36
        });
37
    }
38
}
39