AbstractStaticEntity   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 7
eloc 9
dl 0
loc 42
ccs 14
cts 14
cp 1
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A toId() 0 3 1
A getAll() 0 3 1
A hasId() 0 3 1
A getAssociative() 0 3 1
A getIds() 0 3 1
A getId() 0 3 1
A get() 0 3 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Byscripts\StaticEntity;
5
6
abstract class AbstractStaticEntity implements StaticEntityInterface
7
{
8
    protected $id;
9
10 4
    /**
11
     * @param $id
12 4
     *
13
     * @return $this
14
     */
15 3
    static public function get($id): StaticEntityInterface
16
    {
17 3
        return Provider::get(get_called_class(), $id);
18
    }
19
20 1
    static public function getAll(): array
21
    {
22 1
        return Provider::getAll(get_called_class());
23
    }
24
25 3
    static public function hasId($id): bool
26
    {
27 3
        return Provider::hasId(get_called_class(), $id);
28
    }
29
30 1
    static public function toId($classOrId)
31
    {
32 1
        return Provider::toId(get_called_class(), $classOrId);
33
    }
34
35 1
    static public function getAssociative(string $key = 'name'): array
36
    {
37 1
        return Provider::getAssociative(get_called_class(), $key);
38
    }
39
40 4
    static public function getIds(): array
41
    {
42 4
        return Provider::getIds(get_called_class());
43
    }
44
45
    public function getId()
46
    {
47
        return $this->id;
48
    }
49
}
50