HashTable.php 697 Bytes
Newer Older
Jonty Newman's avatar
Jonty Newman committed
1
2
3
4
5
6
7
<?php

namespace ShrooPHP\RESTful\Collections;

use ShrooPHP\RESTful\Collection;
use ShrooPHP\RESTful\Collection\Traits\HashTable as HashTableTrait;

Jonty Newman's avatar
Jonty Newman committed
8
9
10
/**
 * A collection that stores resources in memory.
 */
Jonty Newman's avatar
Jonty Newman committed
11
12
13
14
class HashTable implements Collection
{
	use HashTableTrait;

Jonty Newman's avatar
Jonty Newman committed
15
16
17
18
19
	/**
	 * The current maximum length of the underlying hash table (if any).
	 *
	 * @var int|null
	 */
Jonty Newman's avatar
Jonty Newman committed
20
21
	private $limit;

Jonty Newman's avatar
Jonty Newman committed
22
23
24
25
26
27
	/**
	 * Constructs a collection that stores resources in memory
	 *
	 * @param int|null $limit The maximum length of the underlying hash table
	 * (if any).
	 */
Jonty Newman's avatar
Jonty Newman committed
28
29
30
31
32
33
34
35
36
37
	public function __construct(int $limit = null)
	{
		$this->limit = $limit;
	}

	protected function limit(): ?int
	{
		return $this->limit;
	}
}