Factory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 9
dl 0
loc 17
c 0
b 0
f 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A make() 0 14 2
1
<?php
2
3
namespace TelegramBot\Entities\MenuButton;
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
            'commands' => MenuButtonCommands::class,
14
            'web_app' => MenuButtonWebApp::class,
15
            'default' => MenuButtonDefault::class,
16
        ];
17
18
        if (!isset($type[$data['type'] ?? ''])) {
19
            return new MenuButtonNotImplemented($data);
20
        }
21
22
        $class = $type[$data['type']];
23
        return new $class($data);
24
    }
25
26
}
27