| Conditions | 3 |
| Paths | 4 |
| Total Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 28 | 45 | public function __construct($value = null) |
|
| 29 | { |
||
| 30 | // Use the default value when no value is supplied, this cannot be omitted due to |
||
| 31 | // non-strict comparison null == 0, resulting in the integer 0. |
||
| 32 | 45 | if (is_null($value)) { |
|
| 33 | 15 | $value = static::__default; |
|
| 34 | } |
||
| 35 | |||
| 36 | // Verify the supplied value is present when we don't check for the type. |
||
| 37 | 45 | if (\in_array($value, static::toArray(), false)) { |
|
| 38 | 45 | $value = (int) $value; |
|
| 39 | } |
||
| 40 | |||
| 41 | 45 | parent::__construct($value); |
|
| 42 | 45 | } |
|
| 43 | } |
||
| 44 |