Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
10 / 10
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
ListingHandler
100.00% covered (success)
100.00%
10 / 10
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 resolve
100.00% covered (success)
100.00%
10 / 10
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5namespace Cosray\Collection\Schema;
6
7use Cosray\CollectionListMeta;
8use Cosray\Schema\Listing;
9use Override;
10
11class 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}