Passed
Branch master (f36b3c)
by Matthew
08:01
created

Debug::services()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 16
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 8
c 2
b 0
f 0
dl 0
loc 16
ccs 9
cts 9
cp 1
rs 10
cc 2
nc 1
nop 0
crap 2
1
<?php
2
namespace Fyuze\Kernel\Services;
3
4
use Fyuze\Debug\Collectors\Performance;
5
use Fyuze\Debug\Collectors\Response;
6
use Fyuze\Debug\Toolbar;
7
use Fyuze\Kernel\Service;
8
use Fyuze\Debug\Collectors\Database as DatabaseCollector;
9
10
class Debug extends Service
11
{
12
13
    /**
14
     * Once the has started
15
     */
16 5
    public function bootstrap()
17
    {
18 5
        $this->registry->make('toolbar')
19 5
            ->addCollector(new Response($this->registry->make('response')), true);
20
    }
21
22
    /**
23
     * @return void
24
     */
25 5
    public function services()
26
    {
27 5
        $this->registry->add('toolbar', function ($app) {
0 ignored issues
show
Unused Code introduced by
The parameter $app is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

27
        $this->registry->add('toolbar', function (/** @scrutinizer ignore-unused */ $app) {

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

Loading history...
28
29 5
            $toolbar = new Toolbar();
30 5
            $collectors = [];
31
32 5
            $collectors[] = new Performance();
33 5
            $collectors[] = new DatabaseCollector($this->registry->make('db'));
34
35 5
            foreach ($collectors as $collector) {
36
37 5
                $toolbar->addCollector($collector);
38
            }
39
40 5
            return $toolbar;
41 5
        });
42
    }
43
}
44