1 | <?php |
||
25 | abstract class AbstractMap extends AbstractCollection |
||
26 | { |
||
27 | /** |
||
28 | * Insert a new key value Pair into the Map |
||
29 | * |
||
30 | * @param Pair<KeyType, ValueType> $pair |
||
31 | */ |
||
32 | abstract public function insert(Pair $pair); |
||
33 | |||
34 | /** |
||
35 | * Gets the item, looking it up with the specified key |
||
36 | * |
||
37 | * @param KeyType $item The key to search by |
||
38 | * @return ValueType The item |
||
39 | */ |
||
40 | abstract public function get($item); |
||
41 | |||
42 | /** |
||
43 | * Removes an item, looking it up with the specified key |
||
44 | * |
||
45 | * @param KeyType $item The key of the keypair to remove |
||
46 | */ |
||
47 | abstract public function remove($item); |
||
48 | |||
49 | /** |
||
50 | * Checks if the specified key exists in this map |
||
51 | * |
||
52 | * @param KeyType $key The key to search for |
||
53 | * @return boolean |
||
54 | */ |
||
55 | abstract public function containsKey($key) : bool; |
||
56 | |||
57 | /** |
||
58 | * Adds an element to the Map |
||
59 | * |
||
60 | * @param KeyType $key The key to add |
||
61 | * @param ValueType $value The value to add |
||
62 | */ |
||
63 | 19 | public function offsetSet($key, $value) |
|
67 | |||
68 | /** |
||
69 | * Adds an element to the Map |
||
70 | * |
||
71 | * @param KeyType $key The key to add |
||
72 | * @param ValueType $value The value to add |
||
73 | */ |
||
74 | 22 | public function add($key, $value) |
|
78 | |||
79 | /** |
||
80 | * Checks if a key exists |
||
81 | * |
||
82 | * @param KeyType $key The key to search for |
||
83 | * @return boolean |
||
84 | */ |
||
85 | public function offsetExists($key) : bool |
||
89 | |||
90 | /** |
||
91 | * Removes an item from the map |
||
92 | * |
||
93 | * @param KeyType $key The key of the keypair to remove |
||
94 | */ |
||
95 | public function offsetUnset($key) |
||
99 | |||
100 | /** |
||
101 | * Gets an item from the map, looking it up by the specified key |
||
102 | * |
||
103 | * @param KeyType $key |
||
104 | * @return ValueType |
||
105 | */ |
||
106 | 33 | public function offsetGet($key) |
|
110 | } |
||
111 |