1 | <?php |
||
12 | class Transformer implements TransformerInterface |
||
13 | { |
||
14 | /** @var ValidatorInterface */ |
||
15 | private $inputValidator; |
||
16 | |||
17 | /** @var ExtractionInterface */ |
||
18 | private $extractor; |
||
19 | |||
20 | /** @var callable */ |
||
21 | private $transformer; |
||
22 | |||
23 | /** @var HydrationInterface */ |
||
24 | private $hydrator; |
||
25 | |||
26 | /** @var ValidatorInterface */ |
||
27 | private $outputValidator; |
||
28 | |||
29 | /** |
||
30 | * Transformer constructor. |
||
31 | * @param ValidatorInterface $inputValidator |
||
32 | * @param ExtractionInterface $extractor |
||
33 | * @param callable $transformer |
||
34 | * @param HydrationInterface $hydrator |
||
35 | * @param ValidatorInterface $outputValidator |
||
36 | */ |
||
37 | public function __construct( |
||
50 | |||
51 | /** |
||
52 | * @param mixed $input |
||
53 | * @param mixed|string $output |
||
54 | * @return mixed |
||
55 | * @throws \Abacaphiliac\Zend\Transformer\Exception\TransformationException |
||
56 | */ |
||
57 | public function transform($input, $output) |
||
82 | |||
83 | /** |
||
84 | * @param mixed $object |
||
85 | * @param ValidatorInterface $validator |
||
86 | * @return void |
||
87 | * @throws \Zend\Validator\Exception\RuntimeException |
||
88 | * @throws AssertionFailedException |
||
89 | */ |
||
90 | private function validateObject($object, ValidatorInterface $validator) |
||
98 | |||
99 | /** |
||
100 | * @param mixed $object |
||
101 | * @return mixed[] |
||
102 | * @throws AssertionFailedException |
||
103 | */ |
||
104 | private function extract($object) |
||
114 | |||
115 | /** |
||
116 | * @param mixed[] $input |
||
117 | * @return mixed[] |
||
118 | * @throws AssertionFailedException |
||
119 | */ |
||
120 | private function transformInputData(array $input) |
||
128 | |||
129 | /** |
||
130 | * @param mixed[] $data |
||
131 | * @param mixed|string $object |
||
132 | * @return mixed |
||
133 | * @throws AssertionFailedException |
||
134 | */ |
||
135 | private function hydrate(array $data, $object) |
||
145 | } |
||
146 |