GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 93073b...e57a14 )
by Freek
01:19
created

ValidatedAddress::hasErrors()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Spatie\BpostAddressWebservice;
4
5
/**
6
 * @property string streetName
7
 * @property string streetNumber
8
 * @property string boxNumber
9
 * @property string postalCode
10
 * @property string municipalityName
11
 * @property string country
12
 * @property array issues
13
 */
14
class ValidatedAddress
15
{
16
    /** @var \Spatie\BpostAddressWebservice\Address */
17
    public $validatedAddress;
18
19
    /** @var \Spatie\BpostAddressWebservice\Address */
20
    public $originalAddress;
21
22
    /** @var \Spatie\BpostAddressWebservice\Issues\Error[] */
23
    public $errors;
24
25
    /** @var \Spatie\BpostAddressWebservice\Issues\Warning[] */
26
    public $warnings;
27
28
    public function __construct(
29
        Address $validatedAddress,
30
        Address $originalAddress,
31
        array $errors,
32
        array $warnings
33
    ) {
34
        $this->validatedAddress = $validatedAddress;
35
        $this->originalAddress = $originalAddress;
36
37
        $this->errors = $errors;
38
        $this->warnings = $warnings;
39
    }
40
41
    public function hasErrors(): bool
42
    {
43
        return count($this->errors) > 0;
44
    }
45
46
    public function hasWarnings(): bool
47
    {
48
        return count($this->warnings) > 0;
49
    }
50
51
    public function hasIssues(): bool
52
    {
53
        return $this->hasWarnings() || $this->hasErrors();
54
    }
55
56
    public function issues(): array
57
    {
58
        return array_merge($this->warnings, $this->errors);
59
    }
60
61
    public function originalAddress(): Address
62
    {
63
        return $this->originalAddress;
64
    }
65
66
    public function toArray(): array
67
    {
68
        return $this->validatedAddress->toArray();
69
    }
70
71
    public function __get(string $key)
72
    {
73
        if ($key === 'issues') {
74
            return $this->issues;
75
        }
76
77
        return $this->toArray()[$key];
78
    }
79
}
80