SeverityAwareException::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 2
c 1
b 0
f 1
dl 0
loc 8
rs 10
cc 1
nc 1
nop 4
1
<?php declare(strict_types=1);
2
3
namespace Audiens\AdForm\Exception;
4
5
use Throwable;
6
7
/**
8
 * Base Exception
9
 */
10
class SeverityAwareException extends \Exception
11
{
12
    public const SEVERITY_CRITICAL = 3;
13
    public const SEVERITY_ERROR = 2;
14
    public const SEVERITY_NOTICE = 1;
15
    public const SEVERITY_INFO = 0;
16
17
    /**
18
     * @var int
19
     */
20
    private $severityLevel;
21
22
    public function __construct(
23
        string $message = '',
24
        int $code = 0,
25
        ?Throwable $previous = null,
26
        int $severityLevel = self::SEVERITY_INFO
27
    ) {
28
        parent::__construct($message, $code, $previous);
29
        $this->severityLevel = $severityLevel;
30
    }
31
32
    public function getSeverityLevel(): int
33
    {
34
        return $this->severityLevel;
35
    }
36
}
37