Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
10 / 10 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| ListingHandler | |
100.00% |
10 / 10 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| resolve | |
100.00% |
10 / 10 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Cosray\Collection\Schema; |
| 6 | |
| 7 | use Cosray\CollectionListMeta; |
| 8 | use Cosray\Schema\Listing; |
| 9 | use Override; |
| 10 | |
| 11 | class ListingHandler extends Handler |
| 12 | { |
| 13 | #[Override] |
| 14 | public function resolve(object $meta, string $class): array |
| 15 | { |
| 16 | assert($meta instanceof Listing, 'The registry maps #[Listing] to this handler'); |
| 17 | |
| 18 | return [ |
| 19 | 'listing' => new CollectionListMeta( |
| 20 | showPublished: $meta->published, |
| 21 | showLocked: $meta->locked, |
| 22 | showHidden: $meta->hidden, |
| 23 | showChildren: $meta->children, |
| 24 | sortable: $meta->sortable, |
| 25 | ), |
| 26 | 'search' => $meta->search, |
| 27 | ]; |
| 28 | } |
| 29 | } |