Passed
Push — master ( 68bcea...c33af3 )
by Felipe
05:11 queued 03:31
created

DebugHandler::__invoke()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 2
nc 1
nop 1
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 * @author Felipe Sayão Lobato Abreu <[email protected]>
4
 * @package CoiSA\ErrorHandler\Handler
5
 * @since 2017-07-24
6
 */
7
8
namespace CoiSA\ErrorHandler\Handler;
9
10
use CoiSA\ErrorHandler\Helper\DebugHelper;
11
12
/**
13
 * Class DebugHandler
14
 * @package CoiSA\ErrorHandler\Handler
15
 */
16
abstract class DebugHandler implements HandlerInterface
17
{
18
    /**
19
     * @var bool Should add HTML <pre> TAG?
20
     */
21
    protected $pretty;
22
23
    /** @var  bool Send exit code? */
24
    protected $exit;
25
26
    /**
27
     * VarExportHandler constructor.
28
     *
29
     * @param bool $pretty
30
     */
31
    public function __construct(bool $pretty = true, $exit = false)
32
    {
33
        $this->pretty = $pretty;
34
        $this->exit = $exit;
35
    }
36
37
    /**
38
     * @param \Throwable $throwable
39
     * @return int|null
40
     */
41
    public function __invoke(\Throwable $throwable): ?int
42
    {
43
        DebugHelper::export($throwable, $this->pretty);
44
45
        return $this->exit ?: null;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->exit ?: null could return the type true which is incompatible with the type-hinted return null|integer. Consider adding an additional type-check to rule them out.
Loading history...
46
    }
47
}