PassInvalidException::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 2
nc 2
nop 2
crap 2
1
<?php
2
3
namespace Passbook\Exception;
4
5
/**
6
 * Thrown when validation of a pass fails.
7
 */
8
class PassInvalidException extends \RuntimeException
9
{
10
    /**
11
     * @var array
12
     */
13
    protected $errors;
14
15
    /**
16
     * Construct a PassInvalidException either with or without an array of errors.
17
     *
18
     * @param string        $message
19
     * @param string[]|null $errors
20
     */
21 4
    public function __construct($message = '', array $errors = null)
22
    {
23 4
        parent::__construct($message);
24 4
        $this->errors = $errors ? $errors : [];
25
    }
26
27
    /**
28
     * Returns the errors with the pass.
29
     *
30
     * @return string[]
31
     */
32 3
    public function getErrors()
33
    {
34 3
        return $this->errors;
35
    }
36
}
37