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