1: <?php
2:
3: declare(strict_types=1);
4:
5: namespace LaravelUi5\OData\Edm\Type;
6:
7: use LaravelUi5\OData\Edm\Contracts\Annotation\AnnotationInterface;
8: use LaravelUi5\OData\Edm\EdmPrimitiveType;
9: use LaravelUi5\OData\Edm\Contracts\Type\TypeDefinitionInterface;
10: use LaravelUi5\OData\Edm\Contracts\Type\TypeFacetsInterface;
11: use LaravelUi5\OData\Edm\HasAnnotations;
12:
13: final readonly class TypeDefinition implements TypeDefinitionInterface
14: {
15: use HasAnnotations;
16:
17: /**
18: * @param list<AnnotationInterface> $annotations
19: */
20: public function __construct(
21: private string $namespace,
22: private string $name,
23: private EdmPrimitiveType $underlyingType,
24: private ?TypeFacetsInterface $facets = null,
25: array $annotations = [],
26: ) {
27: $this->annotations = $annotations;
28: }
29:
30: public function getName(): string
31: {
32: return $this->name;
33: }
34:
35: public function getQualifiedName(): string
36: {
37: return $this->namespace . '.' . $this->name;
38: }
39:
40: public function getUnderlyingType(): EdmPrimitiveType
41: {
42: return $this->underlyingType;
43: }
44:
45: public function getFacets(): ?TypeFacetsInterface
46: {
47: return $this->facets;
48: }
49: }
50: