Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
3 / 3 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| BooleanDisplayProvider | |
100.00% |
3 / 3 |
|
100.00% |
2 / 2 |
3 | |
100.00% |
1 / 1 |
| supports | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
2 | |||
| createComponentFor | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | namespace Apie\HtmlBuilders\FieldDisplayProviders; |
| 3 | |
| 4 | use Apie\HtmlBuilders\Components\Resource\FieldDisplay\BooleanDisplay; |
| 5 | use Apie\HtmlBuilders\FieldDisplayBuildContext; |
| 6 | use Apie\HtmlBuilders\Interfaces\ComponentInterface; |
| 7 | use Apie\HtmlBuilders\Interfaces\FieldDisplayComponentProviderInterface; |
| 8 | |
| 9 | final 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 | } |