PassInvalidException::getErrors()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
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