@@ 111-121 (lines=11) @@ | ||
108 | * @return boolean |
|
109 | * @see offsetExists |
|
110 | */ |
|
111 | public function contains($enumerator) |
|
112 | { |
|
113 | try { |
|
114 | $enumeration = $this->enumeration; |
|
115 | $ord = $enumeration::get($enumerator)->getOrdinal(); |
|
116 | return array_key_exists($ord, $this->map); |
|
117 | } catch (InvalidArgumentException $e) { |
|
118 | // An invalid enumerator can't be contained in this map |
|
119 | return false; |
|
120 | } |
|
121 | } |
|
122 | ||
123 | /** |
|
124 | * Test if the given enumerator key exists and is not NULL |
|
@@ 129-139 (lines=11) @@ | ||
126 | * @return boolean |
|
127 | * @see contains |
|
128 | */ |
|
129 | public function offsetExists($enumerator) |
|
130 | { |
|
131 | try { |
|
132 | $enumeration = $this->enumeration; |
|
133 | $ord = $enumeration::get($enumerator)->getOrdinal(); |
|
134 | return isset($this->map[$ord]); |
|
135 | } catch (InvalidArgumentException $e) { |
|
136 | // An invalid enumerator can't be an offset of this map |
|
137 | return false; |
|
138 | } |
|
139 | } |
|
140 | ||
141 | /** |
|
142 | * Get mapped data for the given enumerator |