1 | <?php |
||
14 | class DataTypeFactory { |
||
15 | |||
16 | /** |
||
17 | * Associative array mapping data type identifiers to DataType objects. |
||
18 | * |
||
19 | * @var DataType[] |
||
20 | */ |
||
21 | private $types = []; |
||
22 | |||
23 | /** |
||
24 | * @var string[] Associative array mapping data type identifiers to data value type identifiers. |
||
25 | */ |
||
26 | private $valueTypes = []; |
||
27 | |||
28 | /** |
||
29 | * @since 0.5 |
||
30 | * |
||
31 | * @param string[] $valueTypes Associative array mapping data type identifiers (also |
||
32 | * referred to as "property types") to data value type identifiers. |
||
33 | * |
||
34 | * @throws InvalidArgumentException |
||
35 | */ |
||
36 | public function __construct( array $valueTypes ) { |
||
49 | |||
50 | /** |
||
51 | * @since 0.1 |
||
52 | * |
||
53 | * @param DataType[] $dataTypes |
||
54 | * |
||
55 | * @return self |
||
56 | */ |
||
57 | public static function newFromTypes( array $dataTypes ) { |
||
66 | |||
67 | /** |
||
68 | * @since 0.1 |
||
69 | * |
||
70 | * @param DataType $dataType |
||
71 | */ |
||
72 | public function registerDataType( DataType $dataType ) { |
||
75 | |||
76 | /** |
||
77 | * Returns the list of registered data type identifiers (also referred to as "property types"). |
||
78 | * |
||
79 | * @since 0.1 |
||
80 | * |
||
81 | * @return string[] |
||
82 | */ |
||
83 | public function getTypeIds() { |
||
86 | |||
87 | /** |
||
88 | * Returns the data type that has the specified type identifier. |
||
89 | * Types may be instantiated on the fly using a type builder spec. |
||
90 | * |
||
91 | * @since 0.1 |
||
92 | * |
||
93 | * @param string $typeId Data type identifier (also referred to as "property type"). |
||
94 | * |
||
95 | * @throws OutOfBoundsException if the requested type is not known. |
||
96 | * @return DataType |
||
97 | */ |
||
98 | public function getType( $typeId ) { |
||
110 | |||
111 | /** |
||
112 | * Returns all data types in an associative array with |
||
113 | * the keys being data type identifiers (also referred to as "property types") pointing to their |
||
114 | * corresponding data type. |
||
115 | * |
||
116 | * @since 0.1 |
||
117 | * |
||
118 | * @return DataType[] |
||
119 | */ |
||
120 | public function getTypes() { |
||
129 | |||
130 | } |
||
131 |