We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2534de0 commit e36a72eCopy full SHA for e36a72e
src/Service/Transformation/Collection.php
@@ -0,0 +1,23 @@
1
+<?php
2
+
3
+declare(strict_types=1);
4
5
+namespace SimpleAsFuck\ApiToolkit\Service\Transformation;
6
7
+final class Collection
8
+{
9
+ /**
10
+ * @template TValue
11
+ * @param iterable<TValue> $transformed
12
+ * @param Transformer<TValue> $transformer
13
+ * @return array<int, \stdClass|\JsonSerializable>
14
+ */
15
+ public static function toApi(iterable $transformed, Transformer $transformer): array
16
+ {
17
+ $apiArray = [];
18
+ foreach ($transformed as $value) {
19
+ $apiArray[] = $transformer->toApi($value);
20
+ }
21
+ return $apiArray;
22
23
+}
0 commit comments