It is generally recommended to explicitly declare the visibility for methods.
Adding explicit visibility (private, protected, or public) is generally
recommend to communicate to other developers how, and from where this method
is intended to be used.
It is generally recommended to explicitly declare the visibility for methods.
Adding explicit visibility (private, protected, or public) is generally
recommend to communicate to other developers how, and from where this method
is intended to be used.
Loading history...
13
14
/**
15
* Ensures that we throw the correct exception when an empty collection is found
16
* @param $method
17
* @throws EmptyException
18
*/
19
protected function emptyGuard($method)
20
{
21
if ($this->isEmpty()) {
22
throw new EmptyException(
23
"{$method} cannot be called when the structure is empty"
24
);
25
}
26
}
27
28
/**
29
* Validates if a key is withing bounds (usually only useful with vectors)
30
* @param $key
31
*/
32
5
protected function validateKeyBounds($key)
33
{
34
5
if (!$this->isBoundedKey($key)) {
35
2
throw new \OutOfBoundsException("Integer key $key is out of bounds");
Adding explicit visibility (
private,protected, orpublic) is generally recommend to communicate to other developers how, and from where this method is intended to be used.