protected function bindDataset($dataset)
    {
        $datasetClass = $this->datasetClass;
        $object = new $datasetClass();

        if ($object instanceof DataSetInterface) {
            return $object->bind($dataset);
        }

        if ($dataset instanceof \Traversable) {
            $dataset = iterator_to_array($dataset);
        } elseif (is_object($dataset)) {
            $dataset = [$dataset];
        } elseif (!is_array($dataset)) {
            throw new \InvalidArgumentException(sprintf('Need an array or object in %s::%s()', __CLASS__, __METHOD__));
        }

        foreach ($dataset as $data) {
            $object[] = $data;
        }

        return $object;
    }
protected function bindDataset($dataset)
    {
        $datasetClass = $this->datasetClass;
        $object = new $datasetClass();

        if ($object instanceof DataSetInterface) {
            return $object->bind($dataset);
        }

        if ($dataset instanceof \Traversable) {
            $dataset = iterator_to_array($dataset);
        } elseif (is_object($dataset)) {
            $dataset = [$dataset];
        } elseif (!is_array($dataset)) {
            throw new \InvalidArgumentException(sprintf('Need an array or object in %s::%s()', __CLASS__, __METHOD__));
        }

        foreach ($dataset as $data) {
            $object[] = $data;
        }

        return $object;
    }
protected function bindDataset ( $ dataset ) { $ datasetClass = $ this -> datasetClass ; $ object = new $ datasetClass ( ) ; if ( $ object instanceof DataSetInterface ) { return $ object -> bind ( $ dataset ) ; } if ( $ dataset instanceof \ Traversable ) { $ dataset = iterator_to_array ( $ dataset ) ; } elseif ( is_object ( $ dataset ) ) { $ dataset = [ $ dataset ] ; } elseif ( ! is_array ( $ dataset ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Need an array or object in %s::%s()' , __CLASS__ , __METHOD__ ) ) ; } foreach ( $ dataset as $ data ) { $ object [ ] = $ data ; } return $ object ; }
Bind records into data set.

@param mixed $dataset Data set we want to bind.

@return  object Data set object.

@throws \UnexpectedValueException
@throws \InvalidArgumentException
Bind records into data set .