ContextProhibitedServiceProvider::boot()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 15

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 15
ccs 8
cts 8
cp 1
rs 9.7666
c 0
b 0
f 0
cc 2
nc 2
nop 0
crap 2
1
<?php
2
3
namespace Swatty007\LaravelContextProhibitedRule;
4
5
use Illuminate\Support\Facades\Validator;
6
use Illuminate\Support\ServiceProvider;
7
use Swatty007\LaravelContextProhibitedRule\Rules\ContextProhibited;
8
9
class ContextProhibitedServiceProvider extends ServiceProvider
10
{
11
    /**
12
     * Bootstrap the application services.
13
     */
14 14
    public function boot()
15
    {
16 14
        Validator::extend('context_prohibited', ContextProhibited::class);
17
18
        /*
19
         * Optional methods to load your package assets
20
         */
21 14
        $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'context-prohibited-rule');
22
23 14
        if ($this->app->runningInConsole()) {
24 14
            $this->publishes([
25 14
                __DIR__.'/../config/config.php' => config_path('context-prohibited-rule.php'),
26 14
            ], 'config');
27
        }
28 14
    }
29
30
    /**
31
     * Register the application services.
32
     */
33 14
    public function register()
34
    {
35
        // Automatically apply the package configuration
36 14
        $this->mergeConfigFrom(__DIR__.'/../config/config.php', 'context-prohibited-rule');
37 14
    }
38
}
39