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

PassInvalidException   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
c 1
b 0
f 1
lcom 0
cbo 0
dl 0
loc 22
rs 10

2 Methods

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