Conditions | 4 |
Paths | 4 |
Total Lines | 10 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
17 | public function getLink(string $name) |
||
18 | { |
||
19 | if (!property_exists($this, 'links')) { |
||
20 | throw new NoLinkedResourceException('No linked resources for' . get_called_class()); |
||
21 | } elseif (!property_exists($this->links, $name)) { |
||
22 | throw new LinkedResourceNotFoundException('No property exists for ' . $name); |
||
23 | } elseif (!property_exists($this->links->$name, 'href')) { |
||
24 | throw new LinkedResourceNotFoundException('href property not found on ' . $name); |
||
25 | } |
||
26 | return $this->links->$name->href; |
||
27 | } |
||
29 |