Enum   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 24
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getInstance() 0 4 1
1
<?php
2
namespace Robusto\Enum;
3
4
/**
5
 * Abstract class for enumerations.
6
 *
7
 * @author Jarddel Antunes
8
 * @package Robusto\Enum
9
 * @copyright 2017 Robusto Enum
10
 */
11
abstract class Enum implements EnumInterface
12
{
13
    use EnumTrait;
14
15
    /**
16
     *
17
     * @param int $value
18
     */
19
    final private function __construct(int $value, string $description = null)
20
    {
21
        $this->value = $value;
22
        $this->description = $description;
23
    }
24
25
    /**
26
     * Get the instance of the enumerative class
27
     *
28
     * @return EnumInterface
29
     */
30
    protected static function getInstance(int $value, string $description = null): EnumInterface
31
    {
32
        return new static($value, $description);
33
    }
34
}
35