1: <?php
2:
3: declare(strict_types=1);
4:
5: namespace LaravelUi5\OData\Edm\Vocabularies;
6:
7: use LaravelUi5\OData\Edm\Contracts\ReferenceInterface;
8: use LaravelUi5\OData\Edm\IncludedSchema;
9: use LaravelUi5\OData\Edm\Reference;
10:
11: /**
12: * A single vocabulary entry in the build-time catalog.
13: *
14: * Carries everything the generator needs to fetch, parse, and emit
15: * PHP classes for one vocabulary: the remote XML source, the OData
16: * namespace and canonical alias, and the target PHP namespace under
17: * which the generated classes will be placed.
18: *
19: * @see VocabularyEntryInterface
20: */
21: final readonly class VocabularyEntry implements VocabularyEntryInterface
22: {
23: /**
24: * @param list<string> $dependencies Aliases of vocabularies this one depends on, e.g. ['Core', 'Validation']
25: */
26: public function __construct(
27: private string $namespace,
28: private string $alias,
29: private string $uri,
30: private string $phpNamespace,
31: private array $dependencies,
32: ) {}
33:
34: public function getNamespace(): string
35: {
36: return $this->namespace;
37: }
38:
39: public function getAlias(): string
40: {
41: return $this->alias;
42: }
43:
44: public function getUri(): string
45: {
46: return $this->uri;
47: }
48:
49: public function getPhpNamespace(): string
50: {
51: return $this->phpNamespace;
52: }
53:
54: /** @return list<string> */
55: public function getDependencies(): array
56: {
57: return $this->dependencies;
58: }
59:
60: public function toReference(): ReferenceInterface
61: {
62: return new Reference(
63: uri: $this->uri,
64: includes: [new IncludedSchema(namespace: $this->namespace, alias: $this->alias)],
65: );
66: }
67: }
68: