mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-06-02 03:54:51 +02:00
added LogicException
This commit is contained in:
parent
73d1659e60
commit
fb4a601bcb
@ -30,6 +30,10 @@ class ObjectCollection
|
|||||||
*/
|
*/
|
||||||
public function sort()
|
public function sort()
|
||||||
{
|
{
|
||||||
|
if (!$this->comparator){
|
||||||
|
throw new \LogicException("Comparator is not set");
|
||||||
|
}
|
||||||
|
|
||||||
$callback = array($this->comparator, 'compare');
|
$callback = array($this->comparator, 'compare');
|
||||||
uasort($this->elements, $callback);
|
uasort($this->elements, $callback);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user