Completed
Push — stable ( 386c57...2cb6a4 )
by Nuno
02:05
created

ConsoleException::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 5
dl 0
loc 8
ccs 5
cts 5
cp 1
crap 1
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * This file is part of Laravel Zero.
5
 *
6
 * (c) Nuno Maduro <[email protected]>
7
 *
8
 *  For the full copyright and license information, please view the LICENSE
9
 *  file that was distributed with this source code.
10
 */
11
12
namespace LaravelZero\Framework\Exceptions;
13
14
use Exception;
15
use LaravelZero\Framework\Contracts\Exceptions\ConsoleException as ConsoleExceptionContract;
16
17
/**
18
 * This is the Laravel Zero Framework Console Exception Implementation.
19
 */
20
class ConsoleException extends Exception implements ConsoleExceptionContract
21
{
22
    /**
23
     * The exit code.
24
     *
25
     * @var int
26
     */
27
    private $exitCode;
28
29
    /**
30
     * The headers.
31
     *
32
     * @var array
33
     */
34
    private $headers;
35
36
    /**
37
     * ConsoleException constructor.
38
     *
39
     * @param int $exitCode
40
     * @param string|null $message
41
     * @param \Exception|null $previous
42
     * @param array $headers
43
     * @param int code
44
     */
45 1
    public function __construct(
46
        int $exitCode, string $message = null, array $headers = [], \Exception $previous = null, ?int $code = 0
47
    ) {
48 1
        $this->exitCode = $exitCode;
49 1
        $this->headers = $headers;
50
51 1
        parent::__construct($message, $code, $previous);
52 1
    }
53
54
    /**
55
     * {@inheritdoc}
56
     */
57 1
    public function getExitCode(): int
58
    {
59 1
        return $this->exitCode;
60
    }
61
62
    /**
63
     * {@inheritdoc}
64
     */
65 1
    public function getHeaders(): array
66
    {
67 1
        return $this->headers;
68
    }
69
70
    /**
71
     * {@inheritdoc}
72
     */
73
    public function setHeaders(array $headers): ConsoleExceptionContract
74
    {
75
        $this->headers = $headers;
76
77
        return $this;
78
    }
79
}
80