Passed
Branch develop (95c346)
by Nuno
02:01
created

ConsoleException   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
dl 0
loc 62
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getHeaders() 0 3 1
A __construct() 0 11 1
A getExitCode() 0 3 1
A setHeaders() 0 5 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
final class ConsoleException extends Exception implements ConsoleExceptionContract
20
{
21
    /**
22
     * The exit code.
23
     *
24
     * @var int
25
     */
26
    private $exitCode;
27
28
    /**
29
     * The headers.
30
     *
31
     * @var array
32
     */
33
    private $headers;
34
35
    /**
36
     * ConsoleException constructor.
37
     *
38
     * @param int $exitCode
39
     * @param string|null $message
40
     * @param \Exception|null $previous
41
     * @param array $headers
42
     * @param int code
0 ignored issues
show
Bug introduced by
The type LaravelZero\Framework\Exceptions\code was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
43
     */
44 3
    public function __construct(
45
        int $exitCode,
46
        string $message = null,
47
        array $headers = [],
48
        \Exception $previous = null,
49
        ?int $code = 0
50
    ) {
51 3
        $this->exitCode = $exitCode;
52 3
        $this->headers = $headers;
53
54 3
        parent::__construct($message, $code, $previous);
55 3
    }
56
57
    /**
58
     * {@inheritdoc}
59
     */
60 2
    public function getExitCode(): int
61
    {
62 2
        return $this->exitCode;
63
    }
64
65
    /**
66
     * {@inheritdoc}
67
     */
68 2
    public function getHeaders(): array
69
    {
70 2
        return $this->headers;
71
    }
72
73
    /**
74
     * {@inheritdoc}
75
     */
76 1
    public function setHeaders(array $headers): ConsoleExceptionContract
77
    {
78 1
        $this->headers = $headers;
79
80 1
        return $this;
81
    }
82
}
83