Passed
Pull Request — develop (#1229)
by
unknown
02:52
created

Factory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Test Coverage

Coverage 75%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
dl 0
loc 11
ccs 3
cts 4
cp 0.75
rs 10
c 1
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A resolveEntityClass() 0 7 2
1
<?php
2
3
4
namespace Longman\TelegramBot\Entities;
5
6
7
abstract class Factory
8
{
9
    abstract public function make(array $data, string $bot_username): Entity;
10
11 15
    public static function resolveEntityClass(string $class, array $property, string $bot_username = ''): Entity
12
    {
13 15
        if (is_subclass_of($class, Factory::class)) {
14
            return $class->make($property, $bot_username);
15
        }
16
17 15
        return new $class($property, $bot_username);
18
    }
19
}
20