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

StudentId   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 29
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 2
A getId() 0 4 1
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
}