src/DataListTrait.php
protected function setDataSource($dataSource)
    {
        if (is_array($dataSource) || $dataSource instanceof \Traversable) {
            foreach ($dataSource as $value) {
                $this->internalDataListData[] = $value;
            }
            return;
        }
        if (is_callable($dataSource)) {
            $this->internalDataListData = $dataSource;
            return;
        }
        throw new \InvalidArgumentException('The data argument must be iterable or a callback that returns such data.');
    }
protected function setDataSource($dataSource)
    {
        if (is_array($dataSource) || $dataSource instanceof \Traversable) {
            foreach ($dataSource as $value) {
                $this->internalDataListData[] = $value;
            }
            return;
        }
        if (is_callable($dataSource)) {
            $this->internalDataListData = $dataSource;
            return;
        }
        throw new \InvalidArgumentException('The data argument must be iterable or a callback that returns such data.');
    }
protected function setDataSource ( $ dataSource ) { if ( is_array ( $ dataSource ) || $ dataSource instanceof \ Traversable ) { foreach ( $ dataSource as $ value ) { $ this -> internalDataListData [ ] = $ value ; } return ; } if ( is_callable ( $ dataSource ) ) { $ this -> internalDataListData = $ dataSource ; return ; } throw new \ InvalidArgumentException ( 'The data argument must be iterable or a callback that returns such data.' ) ; }
Sets a new data source for the list.

@param array|iterable|callback $dataSource An array or an iterable containing objects or arrays that will be converted into data objects or a callback that returns such. The callback option enables lazy data loading.
@throws \InvalidArgumentException
Sets a new data source for the list .