IndustrySpecialityCollection::setPageCount()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
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 IndustrySpecialityCollection 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['id'] = function ($value) { return $value; };
32
        $converters['groups'] = function ($values) {
33
        // by Warringer\Types\Dict
34
        $converters = [];
35
        $converters['id'] = function ($value) { return $value; };
36
37
        $func = function ($value) use($converters) {
38
            $return = new \ArrayObject($value, \ArrayObject::ARRAY_AS_PROPS);
39
            $return['id'] = isset($value->{'id'}) ? $converters['id']($value->{'id'}) : null;
40
            return $return;
41
        };
42
43
            foreach ($values as $key => $value) {
44
                 $values[$key] = $func($value);
45
            }
46
           return $values;
47
        };
48
49
        $converters['name'] = function ($value) { return $value; };
50
51
        $func = function ($value) use($converters) {
52
            $return = new \ArrayObject($value, \ArrayObject::ARRAY_AS_PROPS);
53
            $return['id'] = isset($value->{'id'}) ? $converters['id']($value->{'id'}) : null;
54
            $return['groups'] = isset($value->{'groups'}) ? $converters['groups']($value->{'groups'}) : null;
55
            $return['name'] = isset($value->{'name'}) ? $converters['name']($value->{'name'}) : null;
56
            return $return;
57
        };
58
59
        foreach ($items as $key => $value) {
60
            $this->items[$key] = $func($value);
61
        }
62
    }
63
64
    // by Warringer\Types\Long
65
    public function setTotalCount($totalCount)
66
    {
67
        $this->totalCount = $totalCount;
68
    }
69
70
    // by Warringer\Types\Reference
71
    public function setNext($next)
72
    {
73
        $this->next = new Reference($next);
74
    }
75
76
    // by Warringer\Types\Reference
77
    public function setPrevious($previous)
78
    {
79
        $this->previous = new Reference($previous);
80
    }
81
82
}
83