1 | <?php |
||
23 | abstract class ArrayTransformer implements TransformerInterface |
||
24 | { |
||
25 | /** |
||
26 | * The normalized includes |
||
27 | * |
||
28 | * @var null|array |
||
29 | */ |
||
30 | private $includes; |
||
31 | |||
32 | /** |
||
33 | * @param array $config |
||
34 | */ |
||
35 | public function __construct(array $config = []) |
||
39 | |||
40 | /** |
||
41 | * @return array |
||
42 | */ |
||
43 | protected function defineIncludes(): array |
||
47 | |||
48 | /** |
||
49 | * Returns an array of normalized includes. It is recommend |
||
50 | * @return array |
||
51 | */ |
||
52 | public function getIncludes(): array |
||
62 | |||
63 | /** |
||
64 | * @param mixed $data |
||
65 | * @param callable $transformer |
||
66 | * @return Item |
||
67 | */ |
||
68 | protected function item($data, $transformer): Item |
||
72 | |||
73 | /** |
||
74 | * @param mixed $data |
||
75 | * @param callable $transformer |
||
76 | * @return Collection |
||
77 | */ |
||
78 | protected function collection($data, $transformer): Collection |
||
82 | |||
83 | /** |
||
84 | * The $params consist of all the attributes found on the Class::transform() method. |
||
85 | * |
||
86 | * @param mixed ...$params |
||
87 | * @return array |
||
88 | * @throws \ReflectionException |
||
89 | */ |
||
90 | public function __invoke(Scope $scope, ...$params): array |
||
106 | } |
||
107 |