daikon-cqrs /
entity
| 1 | <?php declare(strict_types=1); |
||
| 2 | /** |
||
| 3 | * This file is part of the daikon-cqrs/entity project. |
||
| 4 | * |
||
| 5 | * For the full copyright and license information, please view the LICENSE |
||
| 6 | * file that was distributed with this source code. |
||
| 7 | */ |
||
| 8 | |||
| 9 | namespace Daikon\Tests\Entity\Fixture; |
||
| 10 | |||
| 11 | use Daikon\Entity\Attribute; |
||
| 12 | use Daikon\Entity\AttributeMap; |
||
| 13 | use Daikon\Entity\Entity; |
||
| 14 | use Daikon\ValueObject\IntValue; |
||
| 15 | use Daikon\ValueObject\Text; |
||
| 16 | use Daikon\ValueObject\ValueObjectInterface; |
||
| 17 | |||
| 18 | final class Paragraph extends Entity |
||
| 19 | { |
||
| 20 | public static function getAttributeMap(): AttributeMap |
||
| 21 | { |
||
| 22 | return new AttributeMap([ |
||
| 23 | Attribute::define('id', IntValue::class), |
||
| 24 | Attribute::define('kicker', Text::class), |
||
| 25 | Attribute::define('content', Text::class) |
||
| 26 | ]); |
||
| 27 | } |
||
| 28 | |||
| 29 | public function getIdentity(): ValueObjectInterface |
||
| 30 | { |
||
| 31 | return $this->getId(); |
||
| 32 | } |
||
| 33 | |||
| 34 | public function getId(): IntValue |
||
| 35 | { |
||
| 36 | return $this->get('id') ?? IntValue::zero(); |
||
|
0 ignored issues
–
show
Bug
Best Practice
introduced
by
Loading history...
|
|||
| 37 | } |
||
| 38 | |||
| 39 | public function getKicker(): Text |
||
| 40 | { |
||
| 41 | return $this->get('kicker') ?? Text::makeEmpty(); |
||
|
0 ignored issues
–
show
|
|||
| 42 | } |
||
| 43 | |||
| 44 | public function getContent(): Text |
||
| 45 | { |
||
| 46 | return $this->get('content') ?? Text::makeEmpty(); |
||
|
0 ignored issues
–
show
|
|||
| 47 | } |
||
| 48 | } |
||
| 49 |