Factory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 12
dl 0
loc 20
c 0
b 0
f 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A make() 0 17 2
1
<?php
2
3
namespace TelegramBot\Entities\ChatMember;
4
5
use TelegramBot\Entity;
6
7
class Factory extends \TelegramBot\Factory
8
{
9
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
    }
28
29
}
30