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

Identifier::value()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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