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