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

Identifier   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 3
c 2
b 0
f 1
lcom 0
cbo 1
dl 0
loc 25
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 InvalidArgumentException;
6
7
use function Assert\that;
8
9
class Identifier
10
{
11
    /**
12
     * @var int|null
13
     */
14
    private $id;
15
16 10
    public function __construct($id, $is_required = true)
17
    {
18 10
        $assert = that($id);
19
20 10
        if (!$is_required) {
21 1
            $assert->nullOr();
22 1
        }
23
24 10
        $assert->integer()->greaterThan(0);
25
26 3
        $this->id = $id;
27 3
    }
28
29 3
    public function value()
30
    {
31 3
        return $this->id;
32
    }
33
}
34