Total Lines | 15 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
21 | public static function getFactory($data) |
||
22 | { |
||
23 | $type = $data['type'] ?? null; |
||
24 | switch ($type) { |
||
25 | case 'preview': |
||
26 | return new PaidMediaPreview($data); |
||
27 | case 'photo': |
||
28 | return new PaidMediaPhoto($data); |
||
29 | case 'video': |
||
30 | return new PaidMediaVideo($data); |
||
31 | default: |
||
32 | // return new static($data); |
||
33 | // throw new TelegramException('Unsupported paid media type: ' . $type); |
||
34 | // Return a base PaidMedia object or handle as an error |
||
35 | return new class($data) extends PaidMedia { protected function subEntities(): array { return [];}}; |
||
36 | } |
||
39 |