Total Complexity | 5 |
Total Lines | 39 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
17 | trait Expose |
||
18 | { |
||
19 | /** |
||
20 | * Expose a single model |
||
21 | */ |
||
22 | public function expose(ModelInterface $item, ?array $expose = null): array |
||
23 | { |
||
24 | $expose ??= $this->getExpose(); |
||
|
|||
25 | |||
26 | if ($item instanceof \Zemit\Mvc\Model) { |
||
27 | return $item->expose($expose); |
||
28 | } |
||
29 | |||
30 | $exposeBuilder = Exposer::createBuilder($item, $expose); |
||
31 | return Exposer::expose($exposeBuilder); |
||
32 | } |
||
33 | |||
34 | /** |
||
35 | * Expose a list of models |
||
36 | */ |
||
37 | public function listExpose(iterable $items, ?array $listExpose = null): array |
||
47 | } |
||
48 | |||
49 | /** |
||
50 | * Expose a list of model |
||
51 | */ |
||
52 | public function exportExpose(iterable $items, $exportExpose = null): array |
||
56 | } |
||
57 | } |
||
58 |