TesterServiceProvider   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 4
dl 0
loc 45
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 15 2
A setTrack() 0 4 1
A register() 0 6 1
1
<?php
2
3
namespace Reallyli\AB;
4
5
use Reallyli\AB\Commands\FlushCommand;
6
use Reallyli\AB\Session\CookieSession;
7
use Illuminate\Support\ServiceProvider;
8
use Reallyli\AB\Commands\ExportCommand;
9
use Reallyli\AB\Commands\ReportCommand;
10
use Reallyli\AB\Commands\InstallCommand;
11
12
class TesterServiceProvider extends ServiceProvider
13
{
14
    /**
15
     * Bootstrap the application events.
16
     *
17
     * @return void
18
     */
19
    public function boot()
20
    {
21
        $this->publishes([
22
            realpath(__DIR__).'/config/config.php' => config_path('ab.php'),
23
        ]);
24
25
        if ($this->app->runningInConsole()) {
26
            $this->commands([
27
                ExportCommand::class,
28
                FlushCommand::class,
29
                InstallCommand::class,
30
                ReportCommand::class,
31
            ]);
32
        }
33
    }
34
35
    /**
36
     * Register the application events.
37
     *
38
     * @return mixed
39
     */
40
    public static function setTrack($request)
41
    {
42
        return (new self())->app['ab']->track($request);
0 ignored issues
show
Bug introduced by
The call to TesterServiceProvider::__construct() misses a required argument $app.

This check looks for function calls that miss required arguments.

Loading history...
43
    }
44
45
    /**
46
     * Register the service provider.
47
     *
48
     * @return void
49
     */
50
    public function register()
51
    {
52
        $this->app->singleton('ab', function () {
53
            return new Tester(new CookieSession);
54
        });
55
    }
56
}
57