Conditions | 4 |
Paths | 1 |
Total Lines | 17 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
1 | <?php |
||
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 | |||
56 |