BaseInt::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace BaseValueObject\Scalar;
4
5
/**
6
 * Class BaseInt
7
 * @package BaseValueObject\Scalar
8
 */
9
abstract class BaseInt extends BaseScalar
10
{
11
    protected $value;
12
13
    /**
14
     * BaseInt constructor.
15
     *
16
     * @param int $value
17
     */
18 3
    public function __construct(int $value)
19
    {
20 3
        $this->setValue($value);
21 3
    }
22
23
    /**
24
     * In this method you must add all the necessary validations.
25
     *
26
     * @param int $value
27
     * @return void
28
     */
29
    abstract protected function setValue(int $value): void;
30
31
    /**
32
     * {@inheritdoc}
33
     *
34
     * @return int
35
     */
36 3
    public function value(): int
37
    {
38 3
        return $this->value;
39
    }
40
}
41