FlightInstructor::registerType()
last analyzed

Size

Total Lines 18
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 8
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 18

1 Method

Rating   Name   Duplication   Size   Complexity  
A FlightInstructor.php$0 ➔ newInstance() 0 3 1
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 FlightInstructor extends ModelElementInstanceImpl
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
            FlightInstructor::class,
24
            TestModelConstants::ELEMENT_NAME_FLIGHT_INSTRUCTOR
25
        )
26
        ->namespaceUri(TestModelConstants::MODEL_NAMESPACE)
27
        ->instanceProvider(
28
            new class implements ModelTypeInstanceProviderInterface
29
            {
30
                public function newInstance(ModelTypeInstanceContext $instanceContext): FlightInstructor
31
                {
32
                    return new FlightInstructor($instanceContext);
33
                }
34
            }
35
        );
36
37
        $typeBuilder->build();
38
    }
39
}
40