Completed
Push — master ( e814e0...e87053 )
by Mārtiņš
01:53
created

ArtworkProductItem::fromArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 14
rs 9.4285
cc 1
eloc 9
nc 1
nop 1
1
<?php
2
3
4
namespace Inktale\Api\Structures;
5
6
7
class ArtworkProductItem extends AbstractBaseItem
8
{
9
    /**
10
     * Product identifier
11
     *
12
     * @var string
13
     */
14
    public $productType;
15
16
    /**
17
     * Public product name (T-shirt, etc)
18
     *
19
     * @var string
20
     */
21
    public $name;
22
23
    /**
24
     * Public products page (purchase page)
25
     *
26
     * @var string
27
     */
28
    public $url;
29
30
    /**
31
     * Thumbnail image URL
32
     * @var
33
     */
34
    public $urlThumb;
35
36
    /**
37
     * Your profit for this product
38
     *
39
     * @var float
40
     */
41
    public $profit;
42
43
    /**
44
     * @param array|mixed $raw
45
     * @return ArtworkProductItem
46
     */
47
    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...
48
    {
49
        $item = new self;
50
51
        $item->raw = $raw;
0 ignored issues
show
Documentation Bug introduced by
It seems like $raw of type * is incompatible with the declared type array of property $raw.

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...
52
53
        $item->productType = $raw['productType'];
54
        $item->name = $raw['name'];
55
        $item->url = $raw['url'];
56
        $item->urlThumb = $raw['urlThumb'];
57
        $item->profit = $raw['profit'];
58
59
        return $item;
60
    }
61
}