Completed
Push — master ( 9e5240...db4f23 )
by
unknown
02:08
created

PassInvalidException::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
rs 10
cc 2
eloc 2
nc 2
nop 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
     * Construct a PassInvalidException either with or without an array of errors.
12
     *
13
     * @param string[]|null $errors
14
     */
15
    public function __construct(array $errors = null)
16
    {
17
        $this->errors = $errors ? $errors : array();
0 ignored issues
show
Bug introduced by
The property errors does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
18
    }
19
20
    /**
21
     * Returns the errors with the pass.
22
     *
23
     * @return string[]
24
     */
25
    public function getErrors()
26
    {
27
        return $this->errors;
28
    }
29
}
30