| 1: | <?php |
| 2: | |
| 3: | declare(strict_types=1); |
| 4: | |
| 5: | namespace LaravelUi5\OData\Edm\Contracts\Type; |
| 6: | |
| 7: | /** |
| 8: | * Type constraint facets that may be applied to a structural property |
| 9: | * or type definition to further restrict the value space of its type. |
| 10: | * |
| 11: | * Not all facets are valid for every primitive type. The spec defines |
| 12: | * applicability per type; enforcement is the responsibility of the |
| 13: | * implementing layer, not this interface. |
| 14: | * |
| 15: | * All facets are optional in CSDL. Methods return null when the facet |
| 16: | * is absent, meaning the type's own default applies. |
| 17: | * |
| 18: | * @see OData CSDL XML v4.01 §7.2 (Type Facets) |
| 19: | */ |
| 20: | interface TypeFacetsInterface |
| 21: | { |
| 22: | /** |
| 23: | * Whether a null value is permitted. |
| 24: | * |
| 25: | * Defaults to true when absent. Applies to all types. |
| 26: | * |
| 27: | * @see OData CSDL XML v4.01 §7.2.1 |
| 28: | */ |
| 29: | public function isNullable(): bool; |
| 30: | |
| 31: | /** |
| 32: | * Maximum length in characters (String) or bytes (Binary). |
| 33: | * |
| 34: | * Null means the facet is absent (no explicit constraint). |
| 35: | * The special value "max" is represented as PHP_INT_MAX by convention. |
| 36: | * |
| 37: | * @see OData CSDL XML v4.01 §7.2.2 |
| 38: | */ |
| 39: | public function getMaxLength(): ?int; |
| 40: | |
| 41: | /** |
| 42: | * Maximum number of significant decimal digits for Decimal, |
| 43: | * or the precision of temporal types in fractional seconds. |
| 44: | * |
| 45: | * Null means the facet is absent. |
| 46: | * |
| 47: | * @see OData CSDL XML v4.01 §7.2.3 |
| 48: | */ |
| 49: | public function getPrecision(): ?int; |
| 50: | |
| 51: | /** |
| 52: | * Maximum number of digits to the right of the decimal point. |
| 53: | * |
| 54: | * Null means the facet is absent. |
| 55: | * The special value "variable" is represented as -1 by convention. |
| 56: | * |
| 57: | * @see OData CSDL XML v4.01 §7.2.4 |
| 58: | */ |
| 59: | public function getScale(): ?int; |
| 60: | |
| 61: | /** |
| 62: | * Whether String values are Unicode (true) or ASCII (false). |
| 63: | * |
| 64: | * Null means the facet is absent; the default is true. |
| 65: | * |
| 66: | * @see OData CSDL XML v4.01 §7.2.5 |
| 67: | */ |
| 68: | public function isUnicode(): ?bool; |
| 69: | |
| 70: | /** |
| 71: | * Spatial Reference System Identifier for Geography/Geometry types. |
| 72: | * |
| 73: | * Null means the facet is absent; defaults apply per type (4326 |
| 74: | * for Geography, 0 for Geometry). |
| 75: | * |
| 76: | * @see OData CSDL XML v4.01 §7.2.6 |
| 77: | */ |
| 78: | public function getSrid(): ?int; |
| 79: | } |
| 80: |