Passed
Branch master (9963ba)
by Brian
03:22
created

MissingIssueFieldException::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 4
nc 2
nop 3
dl 0
loc 9
ccs 5
cts 5
cp 1
crap 2
rs 10
c 1
b 0
f 0
1
<?php
2
/**
3
 * MissingIssueFieldException
4
 */
5
6
namespace Fr3nch13\Jira\Exception;
7
8
use Fr3nch13\Jira\Exception\Exception as BaseException;
9
10
/**
11
 * Missing Issue Exception
12
 *
13
 * Throw when a Project's Issue can't be found.
14
 */
15
class MissingIssueFieldException extends BaseException
16
{
17
    /**
18
     * Throw a 404 when a field is missing.
19
     * @var int
20
     */
21
    protected $_defaultCode = 404;
22
23
    /**
24
     * Constructor.
25
     *
26
     * Allows you to create exceptions that are treated as framework errors and disabled
27
     * when debug mode is off.
28
     *
29
     * @param string|array $message Either the string of the error message, or an array of attributes
30
     *   that are made available in the view, and sprintf()'d into Exception::$_messageTemplate
31
     * @param int|null $code The code of the error, is also the HTTP status code for the error.
32
     * @param \Exception|null $previous the previous exception.
33
     */
34 2
    public function __construct($message = '', $code = null, $previous = null)
35
    {
36 2
        $this->_messageTemplate = __('Missing the issue field: %s');
37
38 2
        if (is_string($message)) {
39 2
            $message = [0 => $message];
40
        }
41
42 2
        parent::__construct($message, $code, $previous);
43 2
    }
44
}
45