BotScoutServiceProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 12 2
A register() 0 8 1
1
<?php
2
3
namespace NicolasBeauvais\LaravelBotScout;
4
5
use GuzzleHttp\Client;
6
use Illuminate\Support\ServiceProvider;
7
use NicolasBeauvais\BotScout\BotScout as BotScoutClient;
8
9
class BotScoutServiceProvider extends ServiceProvider
10
{
11
    /**
12
     * Bootstrap the application services.
13
     */
14
    public function boot()
15
    {
16
        if (app()->runningInConsole()) {
17
            $this->publishes([
18
                __DIR__.'/../config/botscout.php' => config_path('botscout.php'),
19
            ], 'config');
20
        }
21
22
        app('validator')->extend('botscout_name', 'NicolasBeauvais\LaravelBotScout\[email protected]');
23
        app('validator')->extend('botscout_mail', 'NicolasBeauvais\LaravelBotScout\[email protected]');
24
        app('validator')->extend('botscout_ip', 'NicolasBeauvais\LaravelBotScout\[email protected]');
25
    }
26
27
    /**
28
     * Register the application services.
29
     */
30
    public function register()
31
    {
32
        $this->mergeConfigFrom(__DIR__.'/../config/botscout.php', 'botscout');
33
34
        $this->app->singleton('laravel-botscout', function (...$arguments) {
0 ignored issues
show
Unused Code introduced by nicolasbeauvais
The parameter $arguments is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
35
            return new BotScout(new BotScoutClient(new Client(), config('botscout.api_key')));
36
        });
37
    }
38
}
39