| Total Complexity | 4 |
| Total Lines | 32 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | final class DataSetNormalizer |
||
| 19 | 822 | { |
|
| 20 | 79 | /** |
|
| 21 | * Normalizes different types of validated data to a data set: |
||
| 22 | * |
||
| 23 | 748 | * - If {@see $data} is already a data set, it will be left as is. |
|
| 24 | 42 | * - An object is normalized to {@see ObjectDataSet}. |
|
| 25 | * - An array is normalized to {@see ArrayDataSet}. |
||
| 26 | * - Everything else is normalized to {@see SingleValueDataSet}. |
||
| 27 | 710 | * |
|
| 28 | 166 | * In order to prevent mapping objects and arrays to corresponding data sets, wrap them with |
|
| 29 | * {@see SingleValueDataSet} explicitly or use a custom data set ({@see DataSetInterface}). |
||
| 30 | * |
||
| 31 | 573 | * @param mixed $data Raw validated data of any type. |
|
| 32 | * |
||
| 33 | * @return DataSetInterface Data set instance. |
||
| 34 | */ |
||
| 35 | public static function normalize(mixed $data): DataSetInterface |
||
| 52 |