CorporationCollection::setTotalCount()   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 CorporationCollection 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\Dict
30
        $converters = [];
31
        $converters['href'] = function ($value) { return new Uri($value); };
32
        $converters['name'] = function ($value) { return $value; };
33
34
        $func = function ($value) use($converters) {
35
            $return = new \ArrayObject($value, \ArrayObject::ARRAY_AS_PROPS);
36
            $return['href'] = isset($value->{'href'}) ? $converters['href']($value->{'href'}) : null;
37
            $return['name'] = isset($value->{'name'}) ? $converters['name']($value->{'name'}) : null;
38
            return $return;
39
        };
40
41
        foreach ($items as $key => $value) {
42
            $this->items[$key] = $func($value);
43
        }
44
    }
45
46
    // by Warringer\Types\Long
47
    public function setTotalCount($totalCount)
48
    {
49
        $this->totalCount = $totalCount;
50
    }
51
52
    // by Warringer\Types\Reference
53
    public function setNext($next)
54
    {
55
        $this->next = new Reference($next);
56
    }
57
58
    // by Warringer\Types\Reference
59
    public function setPrevious($previous)
60
    {
61
        $this->previous = new Reference($previous);
62
    }
63
64
}
65