Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
BooleanDisplayProvider
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
2 / 2
3
100.00% covered (success)
100.00%
1 / 1
 supports
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
2
 createComponentFor
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2namespace Apie\HtmlBuilders\FieldDisplayProviders;
3
4use Apie\HtmlBuilders\Components\Resource\FieldDisplay\BooleanDisplay;
5use Apie\HtmlBuilders\FieldDisplayBuildContext;
6use Apie\HtmlBuilders\Interfaces\ComponentInterface;
7use Apie\HtmlBuilders\Interfaces\FieldDisplayComponentProviderInterface;
8
9final class BooleanDisplayProvider implements FieldDisplayComponentProviderInterface
10{
11    public function supports(mixed $object, FieldDisplayBuildContext $context): bool
12    {
13        return $object === true || $object === false;
14    }
15    public function createComponentFor(mixed $object, FieldDisplayBuildContext $context): ComponentInterface
16    {
17        assert(is_bool($object));
18        return new BooleanDisplay($object);
19    }
20}