Completed
Push — master ( a1b70a...dd69ef )
by Ezra
02:32
created

Item   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 52
ccs 19
cts 19
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 23 1
1
<?php
2
3
namespace Syntax\SteamApi\Containers;
4
5
class Item extends BaseContainer
6
{
7
    public $id;
8
9
    public $originalId;
10
11
    public $defIndex;
12
13
    public $level;
14
15
    public $quality;
16
17
    public $quantity;
18
19
    public $inventory;
20
21
    public $origin;
22
23
    public $flags;
24
25
    public $containedItem;
26
27
    public $style;
28
29
    public $attributes;
30
31
    public $custom;
32
33 1
    public function __construct($item)
34
    {
35 1
        $this->id            = $item->id;
36 1
        $this->originalId    = $item->original_id;
37 1
        $this->defIndex      = $item->defindex;
38 1
        $this->level         = $item->level;
39 1
        $this->quality       = $item->quality;
40 1
        $this->quantity      = $item->quantity;
41 1
        $this->inventory     = $item->inventory;
42 1
        $this->origin        = $this->checkIssetField($item, 'origin');
43 1
        $this->containedItem = $this->checkIssetField($item, 'contained_item');
44 1
        $this->style         = $this->checkIssetField($item, 'style');
45 1
        $this->attributes    = $this->checkIssetField($item, 'attributes');
46
47 1
        $this->flags  = [
48 1
            'trade' => (boolean)! $this->checkIssetField($item, 'flag_cannot_trade', false),
49 1
            'craft' => (boolean)! $this->checkIssetField($item, 'flag_cannot_craft', false),
50
        ];
51 1
        $this->custom = [
52 1
            'name'        => $this->checkIssetField($item, 'custom_name'),
53 1
            'description' => $this->checkIssetField($item, 'custom_desc'),
54
        ];
55 1
    }
56
}
57