| Conditions | 2 |
| Paths | 2 |
| Total Lines | 17 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 5 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | public static function make(array $data, string $bot_username): Entity |
||
| 10 | { |
||
| 11 | $type = [ |
||
| 12 | 'creator' => ChatMemberOwner::class, |
||
| 13 | 'administrator' => ChatMemberAdministrator::class, |
||
| 14 | 'member' => ChatMemberMember::class, |
||
| 15 | 'restricted' => ChatMemberRestricted::class, |
||
| 16 | 'left' => ChatMemberLeft::class, |
||
| 17 | 'kicked' => ChatMemberBanned::class, |
||
| 18 | ]; |
||
| 19 | |||
| 20 | if (!isset($type[$data['status'] ?? ''])) { |
||
| 21 | return new ChatMemberNotImplemented($data, $bot_username); |
||
| 22 | } |
||
| 23 | |||
| 24 | $class = $type[$data['status']]; |
||
| 25 | return new $class($data, $bot_username); |
||
| 26 | } |
||
| 28 |