IndustryFacilityCollection::setItems()   D
last analyzed

Complexity

Conditions 9
Paths 2

Size

Total Lines 28
Code Lines 21

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 28
rs 4.909
cc 9
eloc 21
nc 2
nop 1
1
<?php
2
namespace Perry\Representation\Eve\v1;
3
4
use \Perry\Representation\Reference as Reference;
5
use \Perry\Representation\Uri as Uri;
6
use \Perry\Representation\Base as Base;
7
8
class IndustryFacilityCollection extends Base
9
{
10
    public $pageCount;
11
12
    public $items = [];
13
14
    public $totalCount;
15
16
    public $next;
17
18
    public $previous;
19
20
    // by Warringer\Types\Long
21
    public function setPageCount($pageCount)
22
    {
23
        $this->pageCount = $pageCount;
24
    }
25
26
    // by Warringer\Types\ArrayType
27
    public function setItems($items)
28
    {
29
        // by Warringer\Types\Base
30
        $converters = [];
31
        $converters['facilityID'] = function ($value) { return $value; };
32
        $converters['solarSystem'] = function ($value) { return $value; };
33
        $converters['name'] = function ($value) { return $value; };
34
        $converters['region'] = function ($value) { return $value; };
35
        $converters['tax'] = function ($value) { return $value; };
36
        $converters['owner'] = function ($value) { return $value; };
37
        $converters['type'] = function ($value) { return $value; };
38
39
        $func = function ($value) use($converters) {
40
            $return = new \ArrayObject($value, \ArrayObject::ARRAY_AS_PROPS);
41
            $return['facilityID'] = isset($value->{'facilityID'}) ? $converters['facilityID']($value->{'facilityID'}) : null;
42
            $return['solarSystem'] = isset($value->{'solarSystem'}) ? $converters['solarSystem']($value->{'solarSystem'}) : null;
43
            $return['name'] = isset($value->{'name'}) ? $converters['name']($value->{'name'}) : null;
44
            $return['region'] = isset($value->{'region'}) ? $converters['region']($value->{'region'}) : null;
45
            $return['tax'] = isset($value->{'tax'}) ? $converters['tax']($value->{'tax'}) : null;
46
            $return['owner'] = isset($value->{'owner'}) ? $converters['owner']($value->{'owner'}) : null;
47
            $return['type'] = isset($value->{'type'}) ? $converters['type']($value->{'type'}) : null;
48
            return $return;
49
        };
50
51
        foreach ($items as $key => $value) {
52
            $this->items[$key] = $func($value);
53
        }
54
    }
55
56
    // by Warringer\Types\Long
57
    public function setTotalCount($totalCount)
58
    {
59
        $this->totalCount = $totalCount;
60
    }
61
62
    // by Warringer\Types\Reference
63
    public function setNext($next)
64
    {
65
        $this->next = new Reference($next);
66
    }
67
68
    // by Warringer\Types\Reference
69
    public function setPrevious($previous)
70
    {
71
        $this->previous = new Reference($previous);
72
    }
73
74
}
75