getDatatypes: throw more meaningful exception if no data is present

This commit is contained in:
Christian Bläul
2018-02-18 19:01:47 +01:00
parent f702ca93fe
commit 736bc489e6

View File

@@ -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) {