Total Complexity | 6 |
Total Lines | 47 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
14 | class EnumDetector extends AbstractDetector |
||
15 | { |
||
16 | /** @var array */ |
||
17 | protected $values = []; |
||
18 | |||
19 | /** |
||
20 | * @param string $column |
||
21 | * @param Model $model |
||
22 | * @return mixed |
||
23 | */ |
||
24 | protected function enumValues(string $column, Model $model) |
||
25 | { |
||
26 | return $this->values = enum_values($model->getTable(), $column); |
||
27 | } |
||
28 | |||
29 | /** |
||
30 | * Authorize execution. |
||
31 | * |
||
32 | * @param string $column |
||
33 | * @param Column $metadata |
||
34 | * @param Model $model |
||
35 | * |
||
36 | * @return bool |
||
37 | */ |
||
38 | protected function authorize(string $column, Column $metadata, Model $model): bool |
||
41 | } |
||
42 | |||
43 | /** |
||
44 | * Detect field class. |
||
45 | * |
||
46 | * @param string $column |
||
47 | * @param Column $metadata |
||
48 | * @param Model $model |
||
49 | * |
||
50 | * @return mixed |
||
51 | */ |
||
52 | protected function detect(string $column, Column $metadata, Model $model) |
||
61 | } |
||
62 | } |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
integer
values, zero is a special case, in particular the following results might be unexpected: