Completed
Pull Request — master (#71)
by Robbie
01:33
created

ReverseNullHandler::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace LeKoala\DebugBar\Messages;
4
5
use Monolog\Handler\AbstractHandler;
6
use Monolog\Logger;
7
8
class ReverseNullHandler extends AbstractHandler
9
{
10
    public function __construct($level = Logger::ERROR)
11
    {
12
        parent::__construct($level, false);
13
    }
14
15
    /**
16
     * Reverse the handling logic so that records will be handled up until the
17
     * provided level, rather than for any log level above it
18
     *
19
     * {@inheritDoc}
20
     */
21
    public function isHandling(array $record)
22
    {
23
        return $record['level'] < $this->level;
24
    }
25
26
    public function handle(array $record)
27
    {
28
        // d($record);
0 ignored issues
show
Unused Code Comprehensibility introduced by
67% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
29
        if ($record['level'] >= $this->level) {
30
            return false;
31
        }
32
33
        return true;
34
    }
35
}
36