Conditions | 3 |
Paths | 3 |
Total Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
46 | public function getRelationship(string $key) : IRelationship |
||
47 | { |
||
48 | if (!$this->has($key)) { |
||
49 | throw new Exceptions\RuntimeException(sprintf('Relationship member "%s" is not present.', $key)); |
||
50 | } |
||
51 | |||
52 | $value = $this->{$key}; |
||
53 | |||
54 | if (!is_object($value)) { |
||
55 | throw new Exceptions\RuntimeException(sprintf('Relationship member "%s" is not an object.', $key)); |
||
56 | } |
||
57 | |||
58 | return new Relationship($value); |
||
59 | } |
||
60 | } |
||
61 |