Passed
Push — master ( 083753...993590 )
by Kirill
03:25
created

EnvSuppressErrors   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 4
c 1
b 0
f 1
dl 0
loc 19
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A suppressed() 0 3 1
A __construct() 0 3 1
1
<?php
2
3
/**
4
 * Spiral Framework.
5
 *
6
 * @license   MIT
7
 * @author    Valentin V (Vvval)
8
 */
9
10
declare(strict_types=1);
11
12
namespace Spiral\Http\Middleware\ErrorHandlerMiddleware;
13
14
use Spiral\Boot\EnvironmentInterface;
15
16
class EnvSuppressErrors implements SuppressErrorsInterface
17
{
18
    /** @var EnvironmentInterface */
19
    private $environment;
20
21
    /**
22
     * @param EnvironmentInterface $environment
23
     */
24
    public function __construct(EnvironmentInterface $environment)
25
    {
26
        $this->environment = $environment;
27
    }
28
29
    /**
30
     * @inheritdoc
31
     */
32
    public function suppressed(): bool
33
    {
34
        return !$this->environment->get('DEBUG', false);
35
    }
36
}
37