1 | <?php |
||
15 | class DataMapper |
||
16 | { |
||
17 | /** |
||
18 | * @var DataMapperInterface |
||
19 | */ |
||
20 | protected $dataMapper; |
||
21 | |||
22 | /** |
||
23 | * @var ValidatorInterface |
||
24 | */ |
||
25 | protected $validator; |
||
26 | |||
27 | 10 | public function __construct(DataMapperInterface $dataMapper) |
|
31 | |||
32 | /** |
||
33 | * @return ValidatorInterface |
||
34 | */ |
||
35 | 2 | public function getValidator() |
|
39 | |||
40 | /** |
||
41 | * @param ValidatorInterface $validator |
||
42 | * |
||
43 | * @return $this |
||
44 | */ |
||
45 | 3 | public function setValidator($validator) |
|
46 | { |
||
47 | 3 | $this->validator = $validator; |
|
48 | |||
49 | 3 | return $this; |
|
50 | } |
||
51 | |||
52 | /** |
||
53 | * @return DataMapperInterface |
||
54 | */ |
||
55 | 7 | public function getDataMapper() |
|
59 | |||
60 | /** |
||
61 | * @param mixed $input |
||
62 | * @param bool $preserveKey |
||
63 | * |
||
64 | * @return array |
||
65 | * @throws DataMapperOutputNotValidException |
||
66 | * @throws NotSupportedInputForDataMapperException |
||
67 | */ |
||
68 | 3 | public function mapCollection($input, bool $preserveKey = true) : array |
|
87 | |||
88 | /** |
||
89 | * @param mixed $input |
||
90 | * |
||
91 | * @return mixed |
||
92 | * @throws DataMapperOutputNotValidException |
||
93 | * @throws NotSupportedInputForDataMapperException |
||
94 | */ |
||
95 | 6 | public function map($input) |
|
123 | } |
||
124 |