Conditions | 8 |
Paths | 8 |
Total Lines | 14 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 8.064 |
Changes | 0 |
1 | <?php |
||
117 | 9 | final public static function fromNumber(int $number): self |
|
118 | { |
||
119 | switch ($number) { |
||
120 | 9 | case 1: |
|
121 | 8 | case 2: |
|
122 | 7 | case 3: |
|
123 | 6 | case 4: |
|
124 | 5 | case 5: |
|
125 | 4 | case 6: |
|
126 | 3 | case 7: |
|
127 | 9 | return new self($number); |
|
128 | } |
||
129 | |||
130 | throw new \InvalidArgumentException(sprintf('Given number %d is an invalid WeekDay number', $number)); |
||
131 | } |
||
133 |