Merge pull request #45 from Shaked/patch-1

added LogicException
This commit is contained in:
Dominik Liebler
2013-11-11 06:11:37 -08:00

View File

@@ -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);