bingo-soft /
xml
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Tests\TestModel\Instance; |
||
| 4 | |||
| 5 | use Xml\ModelBuilder; |
||
| 6 | use Xml\Impl\Instance\{ |
||
| 7 | ModelElementInstanceImpl, |
||
| 8 | ModelTypeInstanceContext |
||
| 9 | }; |
||
| 10 | use Xml\Type\ModelTypeInstanceProviderInterface; |
||
| 11 | use Tests\TestModel\TestModelConstants; |
||
| 12 | |||
| 13 | class FriendRelationshipDefinition extends RelationshipDefinition |
||
| 14 | { |
||
| 15 | public function __construct(ModelTypeInstanceContext $instanceContext) |
||
| 16 | { |
||
| 17 | parent::__construct($instanceContext); |
||
| 18 | } |
||
| 19 | |||
| 20 | public static function registerType(ModelBuilder $modelBuilder): void |
||
| 21 | { |
||
| 22 | $typeBuilder = $modelBuilder->defineType( |
||
| 23 | FriendRelationshipDefinition::class, |
||
| 24 | TestModelConstants::TYPE_NAME_FRIEND_RELATIONSHIP_DEFINITION |
||
| 25 | ) |
||
| 26 | ->namespaceUri(TestModelConstants::MODEL_NAMESPACE) |
||
| 27 | ->extendsType(RelationshipDefinition::class) |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 28 | ->instanceProvider( |
||
| 29 | new class implements ModelTypeInstanceProviderInterface |
||
| 30 | { |
||
| 31 | public function newInstance(ModelTypeInstanceContext $instanceContext): FriendRelationshipDefinition |
||
| 32 | { |
||
| 33 | return new FriendRelationshipDefinition($instanceContext); |
||
| 34 | } |
||
| 35 | } |
||
| 36 | ); |
||
| 37 | |||
| 38 | $typeBuilder->build(); |
||
| 39 | } |
||
| 40 | } |
||
| 41 |