Completed
Pull Request — master (#1)
by steven
04:41 queued 02:25
created

Year::__construct()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 4
nc 2
nop 1
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
1
<?php
2
3
namespace VSV\GVQ_API\Question;
4
5
class Year
6
{
7
    /**
8
     * @var int
9
     */
10
    private $value;
11
12
    /**
13
     * @param int $value
14
     */
15
    public function __construct(int $value)
16
    {
17
        if ($value < 2018 || $value > 2100) {
18
            throw new \InvalidArgumentException(
19
                'Invalid value '.$value.' for year, value has to be above 2018 and below 2100'
20
            );
21
        }
22
23
        $this->value = $value;
24
    }
25
}
26