1: <?php declare(strict_types=1);
2:
3: namespace Salient\Contract\Core;
4:
5: /**
6: * @api
7: */
8: interface ArrayMapperInterface
9: {
10: /**
11: * Remove null values from the output array
12: */
13: public const REMOVE_NULL = 1;
14:
15: /**
16: * Add unmapped values to the output array
17: */
18: public const ADD_UNMAPPED = 2;
19:
20: /**
21: * Add missing values to the output array
22: *
23: * `null` is added to the output array if the input array has no data for a
24: * given map.
25: */
26: public const ADD_MISSING = 4;
27:
28: /**
29: * Throw an exception if there are missing values
30: *
31: * An {@InvalidArgumentException} is thrown if the input array has no data
32: * for a given map.
33: */
34: public const REQUIRE_MAPPED = 8;
35:
36: /**
37: * Map an input array to an output array
38: *
39: * @param mixed[] $in
40: * @return mixed[]
41: */
42: public function map(array $in): array;
43: }
44: