PassInvalidException   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 5
c 1
b 0
f 0
dl 0
loc 27
ccs 5
cts 5
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 2
A getErrors() 0 3 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