| 1 | <?php |
||
| 9 | class ArrayMapper implements Mapper |
||
| 10 | { |
||
| 11 | /** @var string */ |
||
| 12 | private $key; |
||
| 13 | |||
| 14 | /** @var string */ |
||
| 15 | private $outputKey; |
||
| 16 | |||
| 17 | /** @var array */ |
||
| 18 | private $mappers = []; |
||
| 19 | |||
| 20 | 2 | public function __construct(string $key, array $fieldMappers, string $outputKey = '') |
|
| 35 | |||
| 36 | 2 | public function key() : string |
|
| 40 | |||
| 41 | /** Returns outputKey passed in constructor. If not passed, returns key value */ |
||
| 42 | 1 | public function outputKey() : string |
|
| 46 | |||
| 47 | /** |
||
| 48 | * Returns associative array with passed mappers. |
||
| 49 | */ |
||
| 50 | 1 | public function map(array $passedData, array $context = []) |
|
| 65 | } |
||
| 66 |