Conditions | 6 |
Paths | 4 |
Total Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
20 | public static function fromValue($value) |
||
21 | { |
||
22 | if (null === $value) { |
||
23 | return self::no(); |
||
24 | } |
||
25 | |||
26 | if (is_numeric($value) || is_int($value) || (int)$value == $value) { |
||
27 | return new self($value == 1); |
||
28 | } |
||
29 | |||
30 | if (is_string($value)) { |
||
31 | return new self(in_array($value, ['y', 't'])); |
||
32 | } |
||
33 | |||
34 | return new self($value); |
||
35 | } |
||
36 | |||
58 | } |