AbstractSystemModelTypeFactory   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 24
ccs 0
cts 11
cp 0
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A parseArgs() 0 10 1
A prefix() 0 3 1
1
<?php
2
3
namespace Leonidas\Library\System\Model;
4
5
class AbstractSystemModelTypeFactory
6
{
7
    protected string $prefix;
8
9
    public function __construct(string $prefix = '')
10
    {
11
        $this->prefix = $prefix;
12
    }
13
14
    protected function parseArgs($args): array
15
    {
16
        $labels = $args['labels'] ?? [];
17
        $plural = $args['plural'] ?? null;
18
        $single = $args['singular'] ?? null;
19
20
        $args['plural'] = $plural ?? $labels['name'];
21
        $args['singular'] = $single ?? $labels['singular_name'] ?? $plural;
22
23
        return $args;
24
    }
25
26
    protected function prefix(string $string)
27
    {
28
        return $this->prefix . $string;
29
    }
30
}
31