System::setPosition()   A
last analyzed

Complexity

Conditions 4
Paths 1

Size

Total Lines 17
Code Lines 12

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 17
rs 9.2
cc 4
eloc 12
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 System extends Base
9
{
10
    public $stats;
11
12
    public $name;
13
14
    public $securityStatus;
15
16
    public $securityClass;
17
18
    public $href;
19
20
    public $planets = [];
21
22
    public $position;
23
24
    public $sovereignty;
25
26
    public $constellation;
27
28
    // by Warringer\Types\Reference
29
    public function setStats($stats)
30
    {
31
        $this->stats = new Reference($stats);
32
    }
33
34
    // by Warringer\Types\String
35
    public function setName($name)
36
    {
37
        $this->name = $name;
38
    }
39
40
    // by Warringer\Types\Base
41
    public function setSecurityStatus($securityStatus)
42
    {
43
        $this->securityStatus = $securityStatus;
44
    }
45
46
    // by Warringer\Types\String
47
    public function setSecurityClass($securityClass)
48
    {
49
        $this->securityClass = $securityClass;
50
    }
51
52
    // by Warringer\Types\Uri
53
    public function setHref($href)
54
    {
55
        $this->href = new Uri($href);
56
    }
57
58
    // by Warringer\Types\ArrayType
59
    public function setPlanets($planets)
60
    {
61
        // by Warringer\Types\Dict
62
        $converters = [];
63
        $converters['href'] = function ($value) { return new Uri($value); };
64
65
        $func = function ($value) use($converters) {
66
            $return = new \ArrayObject($value, \ArrayObject::ARRAY_AS_PROPS);
67
            $return['href'] = isset($value->{'href'}) ? $converters['href']($value->{'href'}) : null;
68
            return $return;
69
        };
70
71
        foreach ($planets as $key => $value) {
72
            $this->planets[$key] = $func($value);
73
        }
74
    }
75
76
    // by Warringer\Types\Dict
77
    public function setPosition($position)
78
    {
79
        // by Warringer\Types\Dict
80
        $converters = [];
81
        $converters['y'] = function ($value) { return $value; };
82
        $converters['x'] = function ($value) { return $value; };
83
        $converters['z'] = function ($value) { return $value; };
84
85
        $func = function ($value) use($converters) {
86
            $return = new \ArrayObject($value, \ArrayObject::ARRAY_AS_PROPS);
87
            $return['y'] = isset($value->{'y'}) ? $converters['y']($value->{'y'}) : null;
88
            $return['x'] = isset($value->{'x'}) ? $converters['x']($value->{'x'}) : null;
89
            $return['z'] = isset($value->{'z'}) ? $converters['z']($value->{'z'}) : null;
90
            return $return;
91
        };
92
        $this->position = $func($position);
93
    }
94
95
    // by Warringer\Types\Reference
96
    public function setSovereignty($sovereignty)
97
    {
98
        $this->sovereignty = new Reference($sovereignty);
99
    }
100
101
    // by Warringer\Types\Reference
102
    public function setConstellation($constellation)
103
    {
104
        $this->constellation = new Reference($constellation);
105
    }
106
107
}
108