1 | <?php |
||
15 | class Transducer implements TransducerInterface |
||
16 | { |
||
17 | /** |
||
18 | * @var array |
||
19 | */ |
||
20 | private $config; |
||
21 | |||
22 | /** |
||
23 | * @param array $config |
||
24 | */ |
||
25 | 19 | private function __construct(array $config) |
|
29 | |||
30 | /** |
||
31 | * @param array $config |
||
32 | * @return static |
||
33 | */ |
||
34 | 19 | public static function create(array $config) |
|
38 | |||
39 | /** |
||
40 | * @param array $data |
||
41 | * @return array |
||
42 | */ |
||
43 | 18 | public function execute(array $data): array |
|
47 | |||
48 | /** |
||
49 | * @param array $data |
||
50 | * @param array $config |
||
51 | * @return array |
||
52 | */ |
||
53 | 18 | private function process(array $data, array $config): array |
|
71 | |||
72 | /** |
||
73 | * @param string|int $value |
||
74 | * @return Carbon |
||
75 | */ |
||
76 | 2 | protected function dateTime($value): Carbon |
|
85 | |||
86 | /** |
||
87 | * @param array $value |
||
88 | * @return array |
||
89 | */ |
||
90 | protected function intArray(array $value): array |
||
98 | |||
99 | /** |
||
100 | * @param array $value |
||
101 | * @return array |
||
102 | */ |
||
103 | protected function floatArray(array $value): array |
||
111 | |||
112 | /** |
||
113 | * @param array $value |
||
114 | * @return array |
||
115 | */ |
||
116 | protected function strArray(array $value): array |
||
124 | |||
125 | /** |
||
126 | * @param mixed $value |
||
127 | * @return int |
||
128 | */ |
||
129 | 7 | protected function integer($value): int |
|
133 | |||
134 | /** |
||
135 | * @param mixed $value |
||
136 | * @return float |
||
137 | */ |
||
138 | 1 | protected function float($value): float |
|
142 | |||
143 | /** |
||
144 | * @param mixed $value |
||
145 | * @return string |
||
146 | */ |
||
147 | 7 | protected function string($value): string |
|
151 | |||
152 | /** |
||
153 | * @param mixed $value |
||
154 | * @return array |
||
155 | */ |
||
156 | 1 | protected function array($value): array |
|
160 | |||
161 | /** |
||
162 | * @param mixed $value |
||
163 | * @return bool |
||
164 | */ |
||
165 | 2 | protected function boolean($value): bool |
|
169 | |||
170 | /** |
||
171 | * @param string $method |
||
172 | * |
||
173 | * @throws ConfigurationException |
||
174 | */ |
||
175 | 18 | private function assertConversionMethodExists(string $method) |
|
181 | } |