| Total Complexity | 4 |
| Total Lines | 42 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | final class Normalize |
||
| 11 | { |
||
| 12 | public const TYPES = ['array', 'bool', 'boolean', 'double', 'float', 'int', 'integer', 'null', 'object', 'string']; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * @param mixed[] $properties |
||
| 16 | * @param string[] $types |
||
| 17 | * |
||
| 18 | * @return mixed[] |
||
| 19 | */ |
||
| 20 | 54 | public static function properties(array $properties, array $types): array |
|
| 21 | { |
||
| 22 | 54 | $properties += \array_fill_keys(\array_keys($types), null); |
|
| 23 | 54 | foreach ($properties as $key => $value) { |
|
| 24 | 54 | $type = $types[$key] ?? '?string'; |
|
| 25 | 54 | $properties[$key] = Property::cast($type, $value); |
|
| 26 | } |
||
| 27 | |||
| 28 | 54 | return $properties; |
|
| 29 | } |
||
| 30 | |||
| 31 | /** |
||
| 32 | * @param string|string[] $shortcode |
||
| 33 | * |
||
| 34 | * @return string[] |
||
| 35 | */ |
||
| 36 | 123 | public static function shortcodes($shortcode): array |
|
| 52 | } |
||
| 53 | } |
||
| 54 |