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