1 | <?php |
||
8 | class ExpandAttributesTransformer implements TransformerInterface |
||
9 | { |
||
10 | /** |
||
11 | * @var string |
||
12 | */ |
||
13 | protected $field; |
||
14 | |||
15 | /** |
||
16 | * @var bool |
||
17 | */ |
||
18 | protected $removeOriginal; |
||
19 | |||
20 | /** |
||
21 | * @var array |
||
22 | */ |
||
23 | protected $overwriteExisting; |
||
24 | |||
25 | /** |
||
26 | * @param string $field Expand attributes in this field, if omitted, all root-level attributes are |
||
27 | * expanded |
||
28 | * @param bool $removeOriginal Whether to remove the original attribute |
||
29 | * @param array $overwriteExisting Keys that may be overwritten when they already exist |
||
30 | * |
||
31 | * @throws UnexpectedTypeException |
||
32 | */ |
||
33 | 20 | public function __construct($field = null, $removeOriginal = false, array $overwriteExisting = []) |
|
43 | |||
44 | /** |
||
45 | * @inheritdoc |
||
46 | */ |
||
47 | 18 | public function transform(ParameterBag $item) |
|
64 | |||
65 | /** |
||
66 | * @param array $value |
||
67 | * |
||
68 | * @return array |
||
69 | */ |
||
70 | 16 | protected function expand(array $value) |
|
93 | } |
||
94 |