1 | <?php |
||
11 | class Map extends AbstractMap |
||
12 | { |
||
13 | use OptionsProperty; |
||
14 | use KeyTypeProperty; |
||
15 | use ElementTypeProperty { |
||
16 | getElementType as getValueType; |
||
17 | checkElementType as checkValueType; |
||
18 | } |
||
19 | |||
20 | /** |
||
21 | * Generic map |
||
22 | * |
||
23 | * example: |
||
24 | * ```php |
||
25 | * new Map('string', Foo::class, [ |
||
26 | * 'one' => new Foo(), |
||
27 | * 'two' => new Foo(), |
||
28 | * ]; |
||
29 | * ``` |
||
30 | * |
||
31 | * Options: |
||
32 | * - Defaults: not allow nulls, allow duplicates, identical comparisons |
||
33 | * - deny duplicates can be activated |
||
34 | * - If allow null elements and deny duplicates, any entry on the map can have a null value |
||
35 | * |
||
36 | * @param string $keyType |
||
37 | * @param string $valueType |
||
38 | * @param array $values |
||
39 | * @param int $options check constants inside Options class |
||
40 | */ |
||
41 | 29 | public function __construct($keyType, $valueType, array $values = [], $options = 0) |
|
48 | } |
||
49 |