Completed
Push — master ( d234f3...0a4926 )
by Jan Philipp
47s queued 12s
created

ExitSignal   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 32
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A success() 0 4 1
A error() 0 4 1
A __construct() 0 5 1
A signal() 0 4 1
1
<?php declare(strict_types=1);
2
3
namespace Shopware\Psh\Application;
4
5
use RuntimeException;
6
use Throwable;
7
8
class ExitSignal extends RuntimeException
9
{
10
    public const RESULT_SUCCESS = 0;
11
12
    public const RESULT_ERROR = 1;
13
14
    /**
15
     * @var int
16
     */
17
    private $signal;
18
19
    public static function success(): self
20
    {
21
        return new self(self::RESULT_SUCCESS);
22
    }
23
24
    public static function error(): self
25
    {
26
        return new self(self::RESULT_ERROR);
27
    }
28
29
    public function __construct(int $signal, $message = '', $code = 0, ?Throwable $previous = null)
30
    {
31
        parent::__construct($message, $code, $previous);
32
        $this->signal = $signal;
33
    }
34
35
    public function signal(): int
36
    {
37
        return $this->signal;
38
    }
39
}
40