DebugbarIntergrator::register()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 17
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 11
CRAP Score 2.0023

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 2
eloc 10
c 2
b 0
f 0
nc 2
nop 0
dl 0
loc 17
ccs 11
cts 12
cp 0.9167
crap 2.0023
rs 9.9332
1
<?php
2
3
namespace Imanghafoori\HeyMan\Boot;
4
5
use DebugBar\DataCollector\MessagesCollector;
6
use Illuminate\Support\Facades\Event;
7
8
class DebugbarIntergrator
9
{
10 121
    public static function register()
11
    {
12 121
        if (! app()->offsetExists('debugbar')) {
13
            return;
14
        }
15
16 121
        app()->singleton('heyman.debugger', function () {
17 121
            return new MessagesCollector('HeyMan');
18 121
        });
19
20 121
        app()->make('debugbar')->addCollector(app('heyman.debugger'));
21
22 121
        Event::listen('heyman_reaction_is_happening', function (...$debug) {
23 58
            app()['heyman_reaction_is_happened_in_debug'] = $debug;
24 58
            resolve('heyman.debugger')->addMessage('HeyMan Rule Matched in file: ');
25 58
            resolve('heyman.debugger')->addMessage($debug[0].' on line: '.$debug[1]);
26 58
            resolve('heyman.debugger')->addMessage($debug[2]);
27 121
        });
28 121
    }
29
}
30