| Conditions | 4 |
| Paths | 4 |
| Total Lines | 11 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 22 | public function getLink(string $name) |
||
| 23 | { |
||
| 24 | if (!property_exists($this, 'links')) { |
||
| 25 | throw new NoLinkedResourceException('No linked resources for ' . get_called_class()); |
||
| 26 | } elseif (!property_exists($this->links, $name)) { |
||
| 27 | throw new LinkedResourceNotFoundException('No property exists for ' . $name . '. Available links are ' . implode(' ', array_keys((array) $this->links))); |
||
| 28 | } elseif (!property_exists($this->links->$name, 'href')) { |
||
| 29 | throw new LinkedResourceNotFoundException('No href property exists for ' . $name); |
||
| 30 | } |
||
| 31 | |||
| 32 | return ['type' => $name, 'path' => $this->links->$name->href, 'responseClass' => get_class($this)]; |
||
| 33 | } |
||
| 35 |