VarnishServiceProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 24
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 10 2
A register() 0 10 1
1
<?php
2
3
namespace DeltaBlue\Varnish;
4
5
use Illuminate\Support\ServiceProvider;
6
use DeltaBlue\Varnish\Commands\FlushVarnishCache;
7
8
class VarnishServiceProvider extends ServiceProvider
9
{
10
    public function boot()
11
    {
12
        if ($this->app->runningInConsole()) {
13
            $configPath = __DIR__.'/../config/varnish.php';
14
15
            $publishPath = base_path('config/varnish.php');
16
17
            $this->publishes([$configPath => $publishPath], 'config');
18
        }
19
    }
20
21
    public function register()
22
    {
23
        $this->mergeConfigFrom(__DIR__.'/../config/varnish.php', 'varnish');
24
25
        $this->app->bind('command.varnish:flush', FlushVarnishCache::class);
26
27
        $this->commands([
28
            'command.varnish:flush',
29
        ]);
30
    }
31
}
32