AbstractStaticEntity::getAssociative()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 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