mirror of
https://github.com/peklaiho/madlisp.git
synced 2024-11-26 15:14:12 +00:00
21 lines
396 B
PHP
21 lines
396 B
PHP
<?php
|
|
namespace MadLisp;
|
|
|
|
class Hash extends Collection
|
|
{
|
|
public function get(string $key)
|
|
{
|
|
if (array_key_exists($key, $this->data)) {
|
|
return $this->data[$key];
|
|
}
|
|
|
|
throw new MadLispException("hash does not contain key $key");
|
|
}
|
|
|
|
public function set(string $key, $value)
|
|
{
|
|
$this->data[$key] = $value;
|
|
return $value;
|
|
}
|
|
}
|