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

Factory::make()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 5
c 1
b 0
f 0
nc 2
nop 2
dl 0
loc 9
rs 10
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