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...
14
15
/**
16
* Ensures that we throw the correct exception when an empty collection is found
17
* @param $method
18
* @throws EmptyException
19
*/
20
protected function emptyGuard($method)
21
{
22
if ($this->isEmpty()) {
23
throw new EmptyException(
24
"{$method} cannot be called when the structure is empty"
25
);
26
}
27
}
28
29
/**
30
* Validates if a key is withing bounds (usually only useful with vectors)
31
* @param $key
32
5
*/
33
protected function validateKeyBounds($key)
34
5
{
35
2
if (!$this->isBoundedKey($key)) {
36
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.