1 | <?php |
||
12 | final class TypeId |
||
13 | { |
||
14 | private function __construct() |
||
15 | { |
||
16 | |||
17 | } |
||
18 | |||
19 | public static function getObject($class) |
||
20 | { |
||
21 | return 'object:' . $class; |
||
22 | } |
||
23 | |||
24 | public static function isObject($id) |
||
25 | { |
||
26 | return strpos($id, 'object:') === 0; |
||
27 | } |
||
28 | |||
29 | public static function getClassTypeFromId($objectId) |
||
33 | |||
34 | public static function getComposite(array $typeIds) |
||
35 | { |
||
36 | return 'composite<' . implode('|', $typeIds) . '>'; |
||
37 | } |
||
38 | |||
39 | public static function isComposite($id) |
||
40 | { |
||
41 | return strpos($id, 'composite<') === 0 && $id[strlen($id) - 1] === '>'; |
||
42 | } |
||
43 | |||
44 | public static function getComposedTypeIdsFromId($compositeId) |
||
48 | |||
49 | public static function fromValue($value) |
||
50 | { |
||
51 | switch (gettype($value)) { |
||
52 | case 'string': |
||
53 | return INativeType::TYPE_STRING; |
||
80 | } |
||
81 |