1212/**
1313 * Interface IElement
1414 *
15- * API elements build the basis for API values, structs and tables. They have a
16- * name, a type, a direction and an optional flag. However, they don't contain
17- * any values.
15+ * API elements are struct or table members and have no direction or optional flag
16+ * of their own.
1817 *
1918 * @package phpsap\interfaces\Api
2019 * @author Gregor J.
2322interface IElement extends IJsonSerializable
2423{
2524 /**
26- * JSON configuration key for type value .
25+ * API element that casts to PHP string .
2726 */
28- public const JSON_TYPE = 'type ' ;
27+ public const TYPE_STRING = 'string ' ;
2928
3029 /**
31- * JSON configuration key for name value .
30+ * API element that casts to PHP int .
3231 */
33- public const JSON_NAME = 'name ' ;
32+ public const TYPE_INTEGER = 'int ' ;
33+
34+ /**
35+ * API element that casts to PHP bool.
36+ */
37+ public const TYPE_BOOLEAN = 'bool ' ;
3438
3539 /**
36- * API input element.
40+ * API element that casts to PHP float .
3741 */
38- public const DIRECTION_INPUT = 'input ' ;
42+ public const TYPE_FLOAT = 'float ' ;
3943
4044 /**
41- * API output element.
45+ * API element that casts to a hexadecimal encoded binary to a binary.
46+ * (direction: output)
4247 */
43- public const DIRECTION_OUTPUT = 'output ' ;
48+ public const TYPE_HEXBIN = 'hexbin ' ;
4449
4550 /**
46- * JSON configuration key for direction value .
51+ * API date element that casts to a DateTime object .
4752 */
48- public const JSON_DIRECTION = 'direction ' ;
53+ public const TYPE_DATE = 'date ' ;
4954
5055 /**
51- * JSON configuration key for is optional flag .
56+ * API time element that casts to a DateTime object .
5257 */
53- public const JSON_OPTIONAL = 'optional ' ;
58+ public const TYPE_TIME = 'time ' ;
59+
60+ /**
61+ * API virtual timestamp element (e.g. string) that casts to a DateTime object.
62+ */
63+ public const TYPE_TIMESTAMP = 'timestamp ' ;
64+
65+ /**
66+ * API virtual calendar week element (e.g. string) that casts to a DateTime object.
67+ */
68+ public const TYPE_WEEK = 'week ' ;
69+
70+ /**
71+ * JSON configuration key for type value.
72+ */
73+ public const JSON_TYPE = 'type ' ;
74+
75+ /**
76+ * JSON configuration key for name value.
77+ */
78+ public const JSON_NAME = 'name ' ;
5479
5580 /**
5681 * The PHP type of the element.
@@ -65,15 +90,10 @@ public function getType(): string;
6590 public function getName (): string ;
6691
6792 /**
68- * Get the direction of the parameter.
69- * interface.
70- * @return string
71- */
72- public function getDirection (): string ;
73-
74- /**
75- * Is the element optional?
76- * @return bool
93+ * Cast a given output value to the implemented value.
94+ * @param bool|int|float|string $value The output to typecast.
95+ * @return bool|int|float|string|SapDateTime|SapDateInterval
96+ * @throws IInvalidArgumentException
7797 */
78- public function isOptional (): bool ;
98+ public function cast ( $ value ) ;
7999}
0 commit comments