Passed
Push — master ( bbc85b...f0bc06 )
by
04:59
created

Factory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 8
c 0
b 0
f 0
dl 0
loc 14
ccs 6
cts 6
cp 1
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A createFromProp() 0 8 2
1
<?php
2
declare(strict_types=1);
3
4
namespace Ely\Mojang\Response\Properties;
5
6
class Factory {
7
8
    private static $MAP = [
9
        'textures' => TexturesProperty::class,
10
    ];
11
12 6
    public static function createFromProp(array $prop): Property {
13 6
        $name = $prop['name'];
14 6
        if (isset(self::$MAP[$name])) {
15 3
            $className = self::$MAP[$name];
16 3
            return new $className($prop);
17
        }
18
19 3
        return new Property($prop);
20
    }
21
22
}
23