Completed
Push — master ( 8ae406...7a819f )
by Mārtiņš
01:47
created

ApiErrorItem::fromArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 12
rs 9.4285
cc 1
eloc 7
nc 1
nop 1
1
<?php
2
3
4
namespace Inktale\Api\Structures;
5
6
7
class ApiErrorItem extends AbstractBaseItem
8
{
9
    /**
10
     * HTTP code
11
     *
12
     * @var int
13
     */
14
    public $code;
15
16
    /**
17
     * Short error title
18
     *
19
     * @var string
20
     */
21
    public $title;
22
23
    /**
24
     * More details about error
25
     *
26
     * @var string
27
     */
28
    public $details;
29
30
    /**
31
     * @param array|mixed $raw
32
     * @return ApiErrorItem
33
     */
34
    static function fromArray($raw)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
35
    {
36
        $item = new self;
37
38
        $item->rawData = $raw;
0 ignored issues
show
Documentation Bug introduced by
It seems like $raw of type * is incompatible with the declared type array of property $rawData.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
39
40
        $item->code = $raw['code'];
41
        $item->title = $raw['title'];
42
        $item->details = $raw['details'];
43
44
        return $item;
45
    }
46
}