Conditions | 3 |
Paths | 3 |
Total Lines | 11 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
15 | public static function createByEntity(AbstractEntity $entity): PeerInterface |
||
16 | { |
||
17 | if ($entity instanceof \Zored\Telegram\Entity\User) { |
||
18 | return new User($entity->getId()); |
||
19 | } |
||
20 | |||
21 | if ($entity instanceof \Zored\Telegram\Entity\Chat) { |
||
22 | return new Channel($entity->getId()); |
||
23 | } |
||
24 | |||
25 | throw PeerFactoryException::becauseNoPeerFound($entity); |
||
26 | } |
||
28 |