1212/**
1313 * Interface IElement
1414 *
15- * API elements are struct or table members and have no direction or optional flag
16- * of their own.
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.
1718 *
1819 * @package phpsap\interfaces\Api
1920 * @author Gregor J.
2223interface IElement extends IJsonSerializable
2324{
2425 /**
25- * API element that casts to PHP string.
26- */
27- public const TYPE_STRING = 'string ' ;
28-
29- /**
30- * API element that casts to PHP int.
31- */
32- public const TYPE_INTEGER = 'int ' ;
33-
34- /**
35- * API element that casts to PHP bool.
36- */
37- public const TYPE_BOOLEAN = 'bool ' ;
38-
39- /**
40- * API element that casts to PHP float.
41- */
42- public const TYPE_FLOAT = 'float ' ;
43-
44- /**
45- * API element that casts to a hexadecimal encoded binary to a binary.
46- * (direction: output)
47- */
48- public const TYPE_HEXBIN = 'hexbin ' ;
49-
50- /**
51- * API date element that casts to a DateTime object.
26+ * JSON configuration key for type value.
5227 */
53- public const TYPE_DATE = 'date ' ;
28+ public const JSON_TYPE = 'type ' ;
5429
5530 /**
56- * API time element that casts to a DateTime object .
31+ * JSON configuration key for name value .
5732 */
58- public const TYPE_TIME = 'time ' ;
33+ public const JSON_NAME = 'name ' ;
5934
6035 /**
61- * API virtual timestamp element (e.g. string) that casts to a DateTime object .
36+ * API input element.
6237 */
63- public const TYPE_TIMESTAMP = 'timestamp ' ;
38+ public const DIRECTION_INPUT = 'input ' ;
6439
6540 /**
66- * API virtual calendar week element (e.g. string) that casts to a DateTime object .
41+ * API output element.
6742 */
68- public const TYPE_WEEK = 'week ' ;
43+ public const DIRECTION_OUTPUT = 'output ' ;
6944
7045 /**
71- * JSON configuration key for type value.
46+ * JSON configuration key for direction value.
7247 */
73- public const JSON_TYPE = 'type ' ;
48+ public const JSON_DIRECTION = 'direction ' ;
7449
7550 /**
76- * JSON configuration key for name value .
51+ * JSON configuration key for is optional flag .
7752 */
78- public const JSON_NAME = 'name ' ;
53+ public const JSON_OPTIONAL = 'optional ' ;
7954
8055 /**
8156 * The PHP type of the element.
@@ -90,10 +65,15 @@ public function getType(): string;
9065 public function getName (): string ;
9166
9267 /**
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
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
9777 */
98- public function cast ( $ value ) ;
78+ public function isOptional (): bool ;
9979}
0 commit comments