| Conditions | 6 |
| Paths | 4 |
| Total Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 31 | 27 | public function generateMention(Mention $mention): ?AbstractInline |
|
| 32 | { |
||
| 33 | 27 | $result = \call_user_func_array($this->callback, [$mention]); |
|
| 34 | 27 | if ($result === null) { |
|
| 35 | 3 | return null; |
|
| 36 | } |
||
| 37 | |||
| 38 | 24 | if ($result instanceof AbstractInline && !($result instanceof Mention)) { |
|
| 39 | 6 | return $result; |
|
| 40 | } |
||
| 41 | |||
| 42 | 18 | if ($result instanceof Mention && $result->hasUrl()) { |
|
| 43 | 9 | return $mention; |
|
| 44 | } |
||
| 45 | |||
| 46 | 9 | throw new \RuntimeException('CallbackGenerator callable must set the URL on the passed mention and return the mention, return a new AbstractInline based object or null if the mention is not a match'); |
|
| 47 | } |
||
| 48 | } |
||
| 49 |