Planet::setName()   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 Planet extends Base
9
{
10
    public $position;
11
12
    public $type;
13
14
    public $system;
15
16
    public $name;
17
18
    // by Warringer\Types\Dict
19
    public function setPosition($position)
20
    {
21
        // by Warringer\Types\Dict
22
        $converters = [];
23
        $converters['y'] = function ($value) { return $value; };
24
        $converters['x'] = function ($value) { return $value; };
25
        $converters['z'] = function ($value) { return $value; };
26
27
        $func = function ($value) use($converters) {
28
            $return = new \ArrayObject($value, \ArrayObject::ARRAY_AS_PROPS);
29
            $return['y'] = isset($value->{'y'}) ? $converters['y']($value->{'y'}) : null;
30
            $return['x'] = isset($value->{'x'}) ? $converters['x']($value->{'x'}) : null;
31
            $return['z'] = isset($value->{'z'}) ? $converters['z']($value->{'z'}) : null;
32
            return $return;
33
        };
34
        $this->position = $func($position);
35
    }
36
37
    // by Warringer\Types\Reference
38
    public function setType($type)
39
    {
40
        $this->type = new Reference($type);
41
    }
42
43
    // by Warringer\Types\Reference
44
    public function setSystem($system)
45
    {
46
        $this->system = new Reference($system);
47
    }
48
49
    // by Warringer\Types\String
50
    public function setName($name)
51
    {
52
        $this->name = $name;
53
    }
54
55
}
56