Completed
Pull Request — master (#4)
by Woody
02:12
created

Identifier   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 0 Features 2
Metric Value
wmc 3
c 3
b 0
f 2
lcom 0
cbo 1
dl 0
loc 32
ccs 10
cts 10
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 12 2
A value() 0 4 1
1
<?php
2
3
namespace Equip\ValueObject;
4
5
use function Assert\that;
6
7
class Identifier
8
{
9
    /**
10
     * @var int|null
11
     */
12
    private $id;
13
14
    /**
15
     * @param int|null $id
16
     * @param boolean $is_required
17
     */
18 10
    public function __construct($id, $is_required = true)
19
    {
20 10
        $assert = that($id);
21
22 10
        if (!$is_required) {
23 1
            $assert->nullOr();
24 1
        }
25
26 10
        $assert->integer()->greaterThan(0);
27
28 3
        $this->id = $id;
29 3
    }
30
31
    /**
32
     * @return int|null
33
     */
34 3
    public function value()
35
    {
36 3
        return $this->id;
37
    }
38
}
39