1 | <?php |
||
21 | class ParameterTypes { |
||
22 | |||
23 | /** |
||
24 | * @since 1.7 |
||
25 | */ |
||
26 | public const BOOLEAN = 'boolean'; |
||
27 | public const FLOAT = 'float'; |
||
28 | public const INTEGER = 'integer'; |
||
29 | public const STRING = 'string'; |
||
30 | public const DIMENSION = 'dimension'; |
||
31 | |||
32 | /** |
||
33 | * @var ParamType[] |
||
34 | */ |
||
35 | private $types = []; |
||
36 | |||
37 | /** |
||
38 | * @param array[] $typeSpecs |
||
39 | */ |
||
40 | 16 | public function __construct( array $typeSpecs = [] ) { |
|
41 | 16 | foreach ( $typeSpecs as $typeName => $typeSpec ) { |
|
42 | 14 | $this->addType( $typeName, $typeSpec ); |
|
43 | } |
||
44 | 16 | } |
|
45 | |||
46 | /** |
||
47 | * @since 1.8 |
||
48 | */ |
||
49 | 16 | public function addType( string $typeName, array $typeSpec ) { |
|
52 | |||
53 | /** |
||
54 | * Package private |
||
55 | */ |
||
56 | 50 | public function hasType( string $typeName ): bool { |
|
59 | |||
60 | /** |
||
61 | * Package private |
||
62 | */ |
||
63 | 80 | public function getType( string $typeName ): ParamType { |
|
66 | |||
67 | /** |
||
68 | * @since 1.8 |
||
69 | */ |
||
70 | 14 | public static function newCoreTypes(): self { |
|
73 | |||
74 | /** |
||
75 | * @since 1.4 |
||
76 | */ |
||
77 | 20 | public static function getCoreTypes(): array { |
|
105 | |||
106 | } |
||
107 |