madlisp/src/Hash.php

21 lines
396 B
PHP
Raw Normal View History

2020-05-28 04:55:58 +00:00
<?php
namespace MadLisp;
class Hash extends Collection
{
public function get(string $key)
{
if (array_key_exists($key, $this->data)) {
2020-05-28 04:55:58 +00:00
return $this->data[$key];
}
throw new MadLispException("hash does not contain key $key");
}
2020-06-02 12:17:18 +00:00
public function set(string $key, $value)
{
$this->data[$key] = $value;
return $value;
}
2020-05-28 04:55:58 +00:00
}