Service   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
dl 0
loc 28
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B boot() 0 26 3
1
<?php namespace GeneaLabs\LaravelWhoopsAtom\Providers;
2
3
use GeneaLabs\LaravelWhoopsAtom\Console\Commands\Publish;
4
use Illuminate\Support\ServiceProvider;
5
6
class Service extends ServiceProvider
7
{
8
    public function boot()
9
    {
10
        if (config('app.env') !== 'production') {
11
            $this->publishes([
12
                __DIR__ . '/../../config/genealabs-laravel-whoops-atom.php'
13
                    => config_path('genealabs-laravel-whoops-atom.php')
14
            ], 'config');
15
16
            config([
17
                'app.editor' => function ($file, $line) {
18
                    $homestead = rtrim(config('genealabs-laravel-whoops-atom.homestead-sites-path'), '/');
19
                    $local = rtrim(config('genealabs-laravel-whoops-atom.local-sites-path'), '/');
20
21
                    if (! $local) {
22
                        return '';
23
                    }
24
25
                    $file = str_replace("{$homestead}/", "{$local}/", $file);
26
27
                    return "atom://open?url=file://{$file}&line={$line}";
28
                },
29
            ]);
30
            $this->commands(Publish::class);
31
            $this->mergeConfigFrom(
32
                __DIR__ . '/../../config/genealabs-laravel-whoops-atom.php',
33
                'genealabs-laravel-whoops-atom'
34
            );
35
        }
36
    }
37
}
38