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 bool |
||
87 | * @throws \Zend\Validator\Exception\RuntimeException |
||
88 | * @throws AssertionFailedException |
||
89 | */ |
||
90 | private function validateObject($object, ValidatorInterface $validator) |
||
100 | |||
101 | /** |
||
102 | * @param mixed $object |
||
103 | * @return mixed[] |
||
104 | * @throws AssertionFailedException |
||
105 | */ |
||
106 | private function extract($object) |
||
116 | |||
117 | /** |
||
118 | * @param mixed[] $input |
||
119 | * @return mixed[] |
||
120 | * @throws AssertionFailedException |
||
121 | */ |
||
122 | private function transformInputData(array $input) |
||
130 | |||
131 | /** |
||
132 | * @param mixed[] $data |
||
133 | * @param mixed|string $object |
||
134 | * @return mixed |
||
135 | * @throws AssertionFailedException |
||
136 | */ |
||
137 | private function hydrate(array $data, $object) |
||
147 | } |
||
148 |