JiraBaseException   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 29
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 3
1
<?php
2
declare(strict_types=1);
3
4
/**
5
 * Exception
6
 */
7
8
namespace Fr3nch13\Jira\Exception;
9
10
use Cake\Core\Exception\CakeException;
11
12
/**
13
 * Issue Submission Exception
14
 *
15
 * The generic Jira specific exception.
16
 */
17
class JiraBaseException extends CakeException
18
{
19
    /**
20
     * @var int Throw a 500 when something goes wrong.
21
     */
22
    protected $_defaultCode = 500;
23
24
    /**
25
     * Constructor.
26
     *
27
     * Allows you to create exceptions that are treated as framework errors and disabled
28
     * when debug mode is off.
29
     *
30
     * @param string|array<int, string> $message Either the string of the error message, or an array of attributes
31
     *   that are made available in the view, and sprintf()'d into Exception::$_messageTemplate
32
     * @param int|null $code The code of the error, is also the HTTP status code for the error.
33
     * @param \Exception|null $previous the previous exception.
34
     */
35 36
    public function __construct($message = '', $code = null, $previous = null)
36
    {
37 36
        if (!$this->_messageTemplate) {
38 2
            $this->_messageTemplate = __('Jira Error(s): %s');
39
        }
40
41 36
        if (is_string($message)) {
42 36
            $message = [0 => $message];
43
        }
44
45 36
        parent::__construct($message, $code, $previous);
46
    }
47
}
48