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

ConsoleException   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 75%

Importance

Changes 0
Metric Value
dl 0
loc 60
ccs 9
cts 12
cp 0.75
rs 10
c 0
b 0
f 0
wmc 4
lcom 0
cbo 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A getExitCode() 0 4 1
A getHeaders() 0 4 1
A setHeaders() 0 6 1
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