ConsoleException::getHeaders()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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