Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
33.33% |
1 / 3 |
|
50.00% |
1 / 2 |
CRAP | |
0.00% |
0 / 1 |
| SafeHtmlDisplayProvider | |
33.33% |
1 / 3 |
|
50.00% |
1 / 2 |
3.19 | |
0.00% |
0 / 1 |
| supports | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| createComponentFor | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | namespace Apie\HtmlBuilders\FieldDisplayProviders; |
| 3 | |
| 4 | use Apie\CommonValueObjects\SafeHtml; |
| 5 | use Apie\HtmlBuilders\Components\Dashboard\RawContents; |
| 6 | use Apie\HtmlBuilders\FieldDisplayBuildContext; |
| 7 | use Apie\HtmlBuilders\Interfaces\ComponentInterface; |
| 8 | use Apie\HtmlBuilders\Interfaces\FieldDisplayComponentProviderInterface; |
| 9 | |
| 10 | final class SafeHtmlDisplayProvider implements FieldDisplayComponentProviderInterface |
| 11 | { |
| 12 | public function supports(mixed $object, FieldDisplayBuildContext $context): bool |
| 13 | { |
| 14 | return $object instanceof SafeHtml; |
| 15 | } |
| 16 | |
| 17 | public function createComponentFor(mixed $object, FieldDisplayBuildContext $context): ComponentInterface |
| 18 | { |
| 19 | assert($object instanceof SafeHtml); |
| 20 | return new RawContents($object); |
| 21 | } |
| 22 | } |