ServiceProvider   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 5
eloc 13
dl 0
loc 26
ccs 0
cts 12
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 10 3
A boot() 0 12 2
1
<?php
2
3
namespace LaravelDuskReporter;
4
5
use LaravelDuskReporter\Commands\PurgeFilesCommand;
6
7
class ServiceProvider extends \Illuminate\Support\ServiceProvider
8
{
9
    public function boot()
10
    {
11
        if ($this->app->runningInConsole()) {
12
            $this->commands([
13
                PurgeFilesCommand::class,
14
            ]);
15
            $this->publishes([
16
                __DIR__.'/../resources/lang' => resource_path('lang/vendor/dusk-reporter'),
17
            ]);
18
        }
19
20
        $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'dusk-reporter');
21
    }
22
23
    public function register()
24
    {
25
        Reporter::$stopReporting      = (bool) getenv('DUSK_REPORT_DISABLED');
26
        Reporter::$disableScreenshots = (bool) getenv('DUSK_SCREENSHOTS_DISABLED');
27
        $this->app->bind(Reporter::class, function () {
28
            if (!Reporter::$storeBuildAt) {
29
                Reporter::$storeBuildAt = base_path(getenv('DUSK_REPORT_PATH') ?: 'storage/laravel-dusk-reporter');
30
            }
31
32
            return new Reporter();
33
        });
34
    }
35
}
36