| 1 | <?php |
||
| 9 | class FieldMapper implements Mapper |
||
| 10 | { |
||
| 11 | /** @var string */ |
||
| 12 | private $key; |
||
| 13 | |||
| 14 | /** @var string */ |
||
| 15 | private $outputKey; |
||
| 16 | |||
| 17 | /** @var Closure */ |
||
| 18 | private $closure; |
||
| 19 | |||
| 20 | 7 | public function __construct(string $key, Closure $closure, string $outputKey = '') |
|
| 30 | |||
| 31 | public function key() : string |
||
| 35 | |||
| 36 | public function outputKey() : string |
||
| 40 | |||
| 41 | /** |
||
| 42 | * Returns associative array with mapped data and context. |
||
| 43 | */ |
||
| 44 | 7 | public function map(array $data, array $context = []) |
|
| 52 | } |
||
| 53 |