EnumWithId   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 1 Features 0
Metric Value
eloc 5
c 3
b 1
f 0
dl 0
loc 37
ccs 7
cts 7
cp 1
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A identifierAttribute() 0 3 1
A getId() 0 3 1
A __construct() 0 3 1
1
<?php
2
3
namespace JosKolenberg\Enum;
4
5
abstract class EnumWithId extends Enum
6
{
7
    /**
8
     * The identifier for the instance.
9
     *
10
     * @var mixed
11
     */
12
    protected $id;
13
14
    /**
15
     * AbstractEnumWithId constructor.
16
     *
17
     * @param $id
18
     */
19 4
    public function __construct($id)
20
    {
21 4
        $this->id = $id;
22 2
    }
23
24
    /**
25
     * Get the id attribute.
26
     *
27
     * @return mixed
28
     */
29 2
    public function getId()
30
    {
31 2
        return $this->id;
32
    }
33
34
    /**
35
     * Return the name of the attribute which stores the identifier.
36
     *
37
     * @return mixed
38
     */
39 14
    protected function identifierAttribute()
40
    {
41 14
        return 'id';
42
    }
43
}
44