1: <?php
2:
3: declare(strict_types=1);
4:
5: namespace LaravelUi5\OData\Edm\Contracts;
6:
7: use LaravelUi5\OData\Edm\Contracts\Type\EnumTypeInterface;
8: use LaravelUi5\OData\Edm\Contracts\Type\ComplexTypeInterface;
9: use LaravelUi5\OData\Edm\Contracts\Type\EntityTypeInterface;
10: use LaravelUi5\OData\Edm\Contracts\Type\TypeDefinitionInterface;
11:
12: /**
13: * A CSDL schema — a namespace that groups a set of type definitions
14: * and functions.
15: *
16: * A service's metadata document contains one or more schemas. Each
17: * schema has a unique namespace and an optional alias. All named
18: * elements within a schema are reachable by their simple name from
19: * within the schema and by their qualified name from anywhere in scope.
20: *
21: * @see OData CSDL XML v4.01 §5 (Schema)
22: */
23: interface SchemaInterface extends AnnotatableInterface, AnnotationTargetInterface
24: {
25: /**
26: * The full namespace of this schema, e.g. "MyService.Data".
27: *
28: * @see OData CSDL XML v4.01 §15.1
29: */
30: public function getNamespace(): string;
31:
32: /**
33: * The optional alias for this schema's namespace, e.g. "self".
34: *
35: * @see OData CSDL XML v4.01 §5.1
36: */
37: public function getAlias(): ?string;
38:
39: /**
40: * All entity types declared in this schema.
41: *
42: * @return list<EntityTypeInterface>
43: */
44: public function getEntityTypes(): array;
45:
46: /**
47: * Returns an entity type by its simple (unqualified) name,
48: * or null when not found.
49: */
50: public function getEntityType(string $name): ?EntityTypeInterface;
51:
52: /**
53: * All complex types declared in this schema.
54: *
55: * @return list<ComplexTypeInterface>
56: */
57: public function getComplexTypes(): array;
58:
59: /**
60: * Returns a complex type by its simple name, or null when not found.
61: */
62: public function getComplexType(string $name): ?ComplexTypeInterface;
63:
64: /**
65: * All enum types declared in this schema.
66: *
67: * @return list<EnumTypeInterface>
68: */
69: public function getEnumTypes(): array;
70:
71: /**
72: * Returns an enum type by its simple name, or null when not found.
73: */
74: public function getEnumType(string $name): ?EnumTypeInterface;
75:
76: /**
77: * All type definitions declared in this schema.
78: *
79: * @return list<TypeDefinitionInterface>
80: */
81: public function getTypeDefinitions(): array;
82:
83: /**
84: * Returns a type definition by its simple name, or null when
85: * not found.
86: */
87: public function getTypeDefinition(string $name): ?TypeDefinitionInterface;
88:
89: /**
90: * All function overloads declared in this schema, grouped by name.
91: *
92: * The array key is the simple function name; the value is a list
93: * of all overloads with that name. Multiple overloads are possible
94: * per the spec.
95: *
96: * @return array<string, list<FunctionInterface>>
97: */
98: public function getFunctions(): array;
99:
100: /**
101: * Returns all overloads of the function with the given simple name,
102: * or an empty array when no such function exists in this schema.
103: *
104: * @return list<FunctionInterface>
105: */
106: public function getFunction(string $name): array;
107: }
108: