Conditions | 3 |
Paths | 3 |
Total Lines | 14 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
19 | protected function findRecipientFromUser(?HasTelegramChatId $recipient): HasTelegramChatId |
||
20 | { |
||
21 | if ($recipient instanceof HasTelegramChatId) { |
||
22 | return $recipient; |
||
23 | } |
||
24 | |||
25 | if (!$recipient = User::findAdmin()) { |
||
26 | throw new InvalidArgumentException( |
||
27 | sprintf('Recipient for event %s is unavailable', static::class) |
||
28 | ); |
||
29 | |||
30 | } |
||
31 | |||
32 | return $recipient; |
||
33 | } |
||
35 |