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

Factory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Test Coverage

Coverage 75%

Importance

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

1 Method

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