Completed
Push — master ( 83dee0...9c2066 )
by Márk
05:19
created

ProductionHandler::handle()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Nofw\Foundation\Whoops\Handler;
6
7
use Whoops\Handler\Handler;
8
9
/**
10
 * Production handler stops the execution chain when the application is in production mode.
11
 *
12
 * @author Márk Sági-Kazár <[email protected]>
13
 */
14
class ProductionHandler extends Handler
15
{
16
    /**
17
     * @var bool
18
     */
19
    private $debug = false;
20
21
    public function __construct(bool $debug)
22
    {
23
        $this->debug = $debug;
24
    }
25
26
    public function handle(): int
27
    {
28
        if ($this->debug) {
29
            return Handler::DONE;
30
        }
31
32
        return Handler::QUIT;
33
    }
34
}
35