Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
90.00% |
9 / 10 |
|
50.00% |
1 / 2 |
CRAP | |
0.00% |
0 / 1 |
| IconHandler | |
90.00% |
9 / 10 |
|
50.00% |
1 / 2 |
3.01 | |
0.00% |
0 / 1 |
| apply | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| properties | |
88.89% |
8 / 9 |
|
0.00% |
0 / 1 |
2.01 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Cosray\Field\Schema; |
| 6 | |
| 7 | use Cosray\Field\Field; |
| 8 | |
| 9 | class IconHandler extends Handler |
| 10 | { |
| 11 | public function apply(object $meta, Field $field): void |
| 12 | { |
| 13 | // Icons only contribute metadata for panel payloads. |
| 14 | } |
| 15 | |
| 16 | public function properties(object $meta, Field $field): array |
| 17 | { |
| 18 | $id = trim((string) $meta->id); |
| 19 | |
| 20 | if ($id === '') { |
| 21 | return ['icon' => null]; |
| 22 | } |
| 23 | |
| 24 | return [ |
| 25 | 'icon' => [ |
| 26 | 'id' => $id, |
| 27 | 'args' => $meta->args, |
| 28 | ], |
| 29 | ]; |
| 30 | } |
| 31 | } |