public function unique(array $array)
    {
        $sorter = (new SortTool)->setComparator($this->getComparator());
        $sorter->sortAssociative($array);
        foreach ($array as $key => $value) {
            if (isset($_last) && ($this->getComparator()->compare($_last, $value) == 0)) {
                unset($array[$key]);
            }
            $_last = $value;
        }
        return $array;
    }
public function unique(array $array)
    {
        $sorter = (new SortTool)->setComparator($this->getComparator());
        $sorter->sortAssociative($array);
        foreach ($array as $key => $value) {
            if (isset($_last) && ($this->getComparator()->compare($_last, $value) == 0)) {
                unset($array[$key]);
            }
            $_last = $value;
        }
        return $array;
    }
public function unique ( array $ array ) { $ sorter = ( new SortTool ) -> setComparator ( $ this -> getComparator ( ) ) ; $ sorter -> sortAssociative ( $ array ) ; foreach ( $ array as $ key => $ value ) { if ( isset ( $ _last ) && ( $ this -> getComparator ( ) -> compare ( $ _last , $ value ) == 0 ) ) { unset ( $ array [ $ key ] ) ; } $ _last = $ value ; } return $ array ; }
Removes duplicate objects from an array based on the Comparator.

Objects $o1, $o2 are considered equal if $comparator->compare($o1,$o2) returns zero.

The resulting array will be sorted, keys maintained, however for same items it is undefined which one is kept.

@param array $array The input array
@return array The filtered array
Removes duplicate objects from an array based on the Comparator .