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
Pull Request — master (#96)
by
unknown
01:04
created

HasErrorProperties::getProperties()   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
declare(strict_types=1);
4
5
namespace Spatie\DataTransferObject;
6
7
trait HasErrorProperties
8
{
9
    /** @var string */
10
    protected $error = '';
11
12
    /** @var string */
13
    protected $class = '';
14
15
    /** @var string */
16
    protected $property = '';
17
18
    /** @var array */
19
    protected $properties = [];
20
21
    /** @var mixed */
22
    protected $value;
23
24
    /** @var string */
25
    protected $type = '';
26
27
    /** @var array */
28
    protected $expectedTypes = [];
29
30
    /**
31
     * Set the error properties
32
     *
33
     * @param array $properties
34
     */
35
    protected function setProperties(array $properties): void
36
    {
37
        foreach ($properties as $key => $value) {
38
            if (property_exists($this, $key)) {
39
                $this->$key = $value;
40
            }
41
        }
42
    }
43
44
    /**
45
     * Get the type of error being thrown
46
     * The error type corresponds to the name of the function that generated it
47
     *
48
     * Error types: unknownProperties, invalidType, uninitialized, immutable
49
     *
50
     * @return string
51
     */
52
    public function getError(): string
53
    {
54
        return $this->error;
55
    }
56
57
    /**
58
     * Get the name of the data transfer object class
59
     *
60
     * Applies to error types: unknownProperties, invalidType, uninitialized, immutable
61
     *
62
     * @return string
63
     */
64
    public function getClass(): string
65
    {
66
        return $this->class;
67
    }
68
69
    /**
70
     * Get the name of the data transfer object property
71
     *
72
     * Applies to error types: invalidType, uninitialized, immutable
73
     *
74
     * @return string
75
     */
76
    public function getProperty(): string
77
    {
78
        return $this->property;
79
    }
80
81
    /**
82
     * Get the names of the data transfer object properties
83
     *
84
     * Applies to error types: unknownProperties
85
     *
86
     * @return array
87
     */
88
    public function getProperties(): array
89
    {
90
        return $this->properties;
91
    }
92
93
    /**
94
     * Get the value of the data transfer object property
95
     *
96
     * Applies to error types: invalidType
97
     *
98
     * @return mixed
99
     */
100
    public function getValue()
101
    {
102
        return $this->value;
103
    }
104
105
    /**
106
     * Get the type of the data transfer object property
107
     *
108
     * Applies to error types: invalidType
109
     *
110
     * @return string
111
     */
112
    public function getType(): string
113
    {
114
        return $this->type;
115
    }
116
117
    /**
118
     * Get the expected types of the data transfer object property
119
     *
120
     * Applies to error types: invalidType
121
     *
122
     * @return array
123
     */
124
    public function getExpectedTypes(): array
125
    {
126
        return $this->expectedTypes;
127
    }
128
}
129