mirror of
https://github.com/furyfire/trueskill.git
synced 2025-04-16 19:14:27 +00:00
More type stuff and unused code removed.
This commit is contained in:
@ -11,14 +11,14 @@ class HashMap
|
||||
|
||||
private array $_hashToKey = [];
|
||||
|
||||
public function getValue($key)
|
||||
public function getValue(string|object $key): mixed
|
||||
{
|
||||
$hash = self::getHash($key);
|
||||
|
||||
return $this->_hashToValue[$hash];
|
||||
}
|
||||
|
||||
public function setValue($key, $value)
|
||||
public function setValue(string|object $key, mixed $value): self
|
||||
{
|
||||
$hash = self::getHash($key);
|
||||
$this->_hashToKey[$hash] = $key;
|
||||
@ -27,22 +27,22 @@ class HashMap
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAllKeys()
|
||||
public function getAllKeys(): array
|
||||
{
|
||||
return array_values($this->_hashToKey);
|
||||
}
|
||||
|
||||
public function getAllValues()
|
||||
public function getAllValues(): array
|
||||
{
|
||||
return array_values($this->_hashToValue);
|
||||
}
|
||||
|
||||
public function count()
|
||||
public function count(): int
|
||||
{
|
||||
return count($this->_hashToKey);
|
||||
}
|
||||
|
||||
private static function getHash($key)
|
||||
private static function getHash(string|Object $key): string
|
||||
{
|
||||
if (is_object($key)) {
|
||||
return spl_object_hash($key);
|
||||
|
Reference in New Issue
Block a user