Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| DescriptionHandler | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| apply | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| properties | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Cosray\Field\Schema; |
| 6 | |
| 7 | use Cosray\Field\Field; |
| 8 | use Cosray\Schema\Description; |
| 9 | use Override; |
| 10 | |
| 11 | class DescriptionHandler extends Handler |
| 12 | { |
| 13 | #[Override] |
| 14 | public function apply(object $meta, Field $field): void |
| 15 | { |
| 16 | assert($meta instanceof Description, 'The registry maps #[Description] to this handler'); |
| 17 | |
| 18 | $field->description($meta->description); |
| 19 | } |
| 20 | |
| 21 | #[Override] |
| 22 | public function properties(object $meta, Field $field): array |
| 23 | { |
| 24 | return ['description' => $field->getDescription()]; |
| 25 | } |
| 26 | } |