Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
4 / 4 |
|
100.00% |
4 / 4 |
CRAP | |
100.00% |
1 / 1 |
| ColumnAttributeHandler | |
100.00% |
4 / 4 |
|
100.00% |
4 / 4 |
4 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| attributeClass | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| targets | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| handle | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Dynart\Micro\Entities\AttributeHandler; |
| 4 | |
| 5 | use Dynart\Micro\AttributeHandlerInterface; |
| 6 | use Dynart\Micro\Entities\Attribute\Column; |
| 7 | use Dynart\Micro\Entities\EntityManager; |
| 8 | |
| 9 | class ColumnAttributeHandler implements AttributeHandlerInterface { |
| 10 | |
| 11 | private EntityManager $entityManager; |
| 12 | |
| 13 | public function __construct(EntityManager $entityManager) { |
| 14 | $this->entityManager = $entityManager; |
| 15 | } |
| 16 | |
| 17 | public function attributeClass(): string { |
| 18 | return Column::class; |
| 19 | } |
| 20 | |
| 21 | public function targets(): array { |
| 22 | return [AttributeHandlerInterface::TARGET_PROPERTY]; |
| 23 | } |
| 24 | |
| 25 | public function handle(string $className, mixed $subject, object $attribute): void { |
| 26 | /** @var Column $attribute */ |
| 27 | $this->entityManager->addColumn($className, $subject->getName(), $attribute); |
| 28 | } |
| 29 | } |