Conditions | 4 |
Paths | 3 |
Total Lines | 20 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
26 | public function __construct(stdClass $descriptor, SemanticDescriptor $parent) |
||
27 | { |
||
28 | parent::__construct($descriptor); |
||
29 | assert(is_string($descriptor->type)); |
||
30 | $this->type = $descriptor->type; |
||
31 | if (! isset($descriptor->rt) || ! is_string($descriptor->rt)) { |
||
32 | assert(is_string($descriptor->id)); |
||
33 | |||
34 | throw new MissingRtException($descriptor->id); |
||
35 | } |
||
36 | |||
37 | assert(is_string($descriptor->id)); |
||
38 | |||
39 | $pos = strpos($descriptor->rt, '#'); |
||
40 | if ($pos === false) { |
||
41 | throw new MissingRtException($descriptor->id); |
||
42 | } |
||
43 | |||
44 | $this->rt = substr($descriptor->rt, $pos + 1); |
||
45 | $this->parent = $parent; |
||
46 | } |
||
48 |