mirror of
https://github.com/parsecsv/parsecsv-for-php.git
synced 2026-02-19 08:36:39 +00:00
getDatatypes: throw more meaningful exception if no data is present
This commit is contained in:
@@ -74,12 +74,17 @@ trait DatatypeTrait {
|
|||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
*
|
*
|
||||||
|
* @uses getDatatypeFromString
|
||||||
|
*
|
||||||
* @return array|bool
|
* @return array|bool
|
||||||
*/
|
*/
|
||||||
public function getDatatypes() {
|
public function getDatatypes() {
|
||||||
if (empty($this->data)) {
|
if (empty($this->data)) {
|
||||||
$this->data = $this->parse_string();
|
$this->data = $this->parse_string();
|
||||||
}
|
}
|
||||||
|
if (!is_array($this->data)) {
|
||||||
|
throw new \Exception('No data set yet.');
|
||||||
|
}
|
||||||
|
|
||||||
$result = [];
|
$result = [];
|
||||||
foreach ($this->titles as $cName) {
|
foreach ($this->titles as $cName) {
|
||||||
|
|||||||
Reference in New Issue
Block a user