Completed
Push — master ( 88150f...580efa )
by Laurent
04:58 queued 02:17
created

StudentId::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 1
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 *
4
 */
5
6
/**
7
 * User id of the student.
8
 *
9
 * @author Laurent De Coninck <[email protected]>
10
 */
11
class StudentId
12
{
13
14
    /**
15
     * @var int
16
     */
17
    private $id;
18
19
    /**
20
     * @param int $id
21
     */
22
    public function __construct($id)
23
    {
24
        if ((int) $id <= 0) {
25
            throw new InvalidArgumentException('Invalid Student ID');
26
        }
27
28
        $this->id = (int) $id;
29
    }
30
31
    /**
32
     * @return int
33
     */
34
    public function getId()
35
    {
36
        return $this->id;
37
    }
38
39
}