1: <?php
2:
3: declare(strict_types=1);
4:
5: namespace LaravelUi5\OData\Edm\Contracts;
6:
7: /**
8: * A reference to an external CSDL document.
9: *
10: * References declare that the current document depends on type
11: * definitions or annotations found in another document, identified
12: * by URI. Each reference may include one or more schemas from the
13: * referenced document into the current scope.
14: *
15: * In a fully resolved model the reference serves as metadata —
16: * recording which external documents were consulted when the model
17: * was built. A serialiser emits these as <edmx:Reference> elements
18: * in the metadata document so that clients can locate the vocabulary
19: * definitions their annotations refer to.
20: *
21: * Common examples are the SAP and OASIS vocabulary documents:
22: *
23: * uri: "https://sap.github.io/odata-vocabularies/vocabularies/UI.xml"
24: * includes: [ { namespace: "com.sap.vocabularies.UI.v1", alias: "UI" } ]
25: *
26: * uri: "https://oasis-tcs.github.io/odata-vocabularies/vocabularies/Org.OData.Core.V1.xml"
27: * includes: [ { namespace: "Org.OData.Core.V1", alias: "Core" } ]
28: *
29: * @see OData CSDL XML v4.01 §4.1 (Reference)
30: */
31: interface ReferenceInterface extends AnnotatableInterface
32: {
33: /**
34: * The URI of the referenced document.
35: *
36: * May be an absolute URI pointing to a published vocabulary, or a
37: * relative URI resolved against the metadata document's base URI.
38: *
39: * @see OData CSDL XML v4.01 §4.1
40: */
41: public function getUri(): string;
42:
43: /**
44: * The schemas included from this referenced document into the
45: * current scope.
46: *
47: * Returns an empty array when the reference is present solely
48: * to pull in external annotations via IncludeAnnotations, which
49: * is outside the scope of this interface layer.
50: *
51: * @return list<IncludedSchemaInterface>
52: * @see OData CSDL XML v4.01 §4.2
53: */
54: public function getIncludes(): array;
55:
56: /**
57: * Returns the included schema for the given namespace, or null
58: * when this reference does not include that namespace.
59: * @param string $namespace
60: * @return IncludedSchemaInterface|null
61: */
62: public function getInclude(string $namespace): ?IncludedSchemaInterface;
63: }
64: