| @@ 65-78 (lines=14) @@ | ||
| 62 | /** |
|
| 63 | * {@inheritdoc} |
|
| 64 | */ |
|
| 65 | public function get($key) |
|
| 66 | { |
|
| 67 | $this->assertObject($key, 'Key'); |
|
| 68 | ||
| 69 | $hash = $this->getHash($key); |
|
| 70 | ||
| 71 | if (!isset($this->keys[$hash])) { |
|
| 72 | throw new OutOfBoundsException('Value with such key not found'); |
|
| 73 | } |
|
| 74 | ||
| 75 | $bucket = $this->keys[$hash]; |
|
| 76 | ||
| 77 | return $this->fetchBucketValue($bucket); |
|
| 78 | } |
|
| 79 | ||
| 80 | /** |
|
| 81 | * {@inheritdoc} |
|
| @@ 95-110 (lines=16) @@ | ||
| 92 | /** |
|
| 93 | * {@inheritdoc} |
|
| 94 | */ |
|
| 95 | public function remove($key) |
|
| 96 | { |
|
| 97 | $this->assertObject($key, 'Key'); |
|
| 98 | ||
| 99 | $hash = $this->getHash($key); |
|
| 100 | ||
| 101 | if (!isset($this->keys[$hash])) { |
|
| 102 | throw new OutOfBoundsException('Value with such key not found'); |
|
| 103 | } |
|
| 104 | ||
| 105 | $bucket = $this->keys[$hash]; |
|
| 106 | ||
| 107 | $this->doRemove($hash); |
|
| 108 | ||
| 109 | return $this->fetchBucketValue($bucket); |
|
| 110 | } |
|
| 111 | ||
| 112 | /** |
|
| 113 | * {@inheritdoc} |
|