public function setData($data) {
        if ($data instanceof \Traversable) {
            $this->data = iterator_to_array($data);
        } else {
            $this->data = $data;
        }

        if (!empty($this->getOrder())) {
            $this->toSort = true;
        }

        return $this;
    }
public function setData($data) {
        if ($data instanceof \Traversable) {
            $this->data = iterator_to_array($data);
        } else {
            $this->data = $data;
        }

        if (!empty($this->getOrder())) {
            $this->toSort = true;
        }

        return $this;
    }
public function setData ( $ data ) { if ( $ data instanceof \ Traversable ) { $ this -> data = iterator_to_array ( $ data ) ; } else { $ this -> data = $ data ; } if ( ! empty ( $ this -> getOrder ( ) ) ) { $ this -> toSort = true ; } return $ this ; }
Set the underlying data array.

@param array|\Traversable $data
@return $this
Set the underlying data array .