| Conditions | 3 |
| Paths | 3 |
| Total Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 30 | 12 | public function generateLink(string $symbol, string $handle): ?Link |
|
| 31 | { |
||
| 32 | 12 | $label = $symbol . $handle; |
|
| 33 | |||
| 34 | 12 | $url = \call_user_func_array($this->callback, [$handle, &$label, $symbol]); |
|
| 35 | 12 | if ($url === null) { |
|
| 36 | 3 | return null; |
|
| 37 | } |
||
| 38 | |||
| 39 | 9 | if (!\is_string($url)) { |
|
| 40 | 3 | throw new \RuntimeException('CallbackLinkGenerator callable must return a string or null'); |
|
| 41 | } |
||
| 42 | |||
| 43 | 6 | return new Link($url, $label); |
|
| 44 | } |
||
| 45 | } |
||
| 46 |