Passed
Push — api-7.0 ( 7410c3...14c77e )
by Armando
28:03 queued 15:34
created

Factory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 12
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A make() 0 9 2
1
<?php
2
3
namespace Longman\TelegramBot\Entities\Message;
4
5
use Longman\TelegramBot\Entities\Entity;
6
use Longman\TelegramBot\Entities\Message;
7
8
class Factory extends \Longman\TelegramBot\Entities\Factory
9
{
10
11
    public static function make(array $data, string $bot_username): Entity
12
    {
13
        if ($data['date'] === 0) {
14
            $class = InaccessibleMessage::class;
15
        } else {
16
            $class = Message::class;
17
        }
18
19
        return new $class($data, $bot_username);
20
    }
21
}
22