| Conditions | 4 |
| Paths | 3 |
| Total Lines | 10 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 4.0466 |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 14 | 5 | public function __construct($id, $is_required = true) |
|
| 15 | { |
||
| 16 | 5 | if (empty($id) && !$is_required) { |
|
| 17 | 2 | $this->id = null; |
|
| 18 | 3 | } elseif ($id > 0) { |
|
| 19 | $this->id = (int) $id; |
||
| 20 | } else { |
||
| 21 | 3 | throw new InvalidArgumentException(sprintf('`%d` must be a valid identifier', $id)); |
|
| 22 | } |
||
| 23 | 2 | } |
|
| 24 | |||
| 30 |