public function __call($callName, $argu)
{
$upperKeyword = strtoupper($callName);
if (in_array($upperKeyword, $this->methodKeyword)) {
$this->method = $upperKeyword;
$this->table = is_array($argu[0]) ? $argu[0] : $argu;
$this->table = str_replace('%pre%', $this->db->dbpre, $this->table);
return $this;
} elseif (in_array($upperKeyword, $this->otherKeyword)) {
if ($upperKeyword == 'INDEX') {
foreach ($argu as $key => $value) {
//is_array($argu[0]) ? $argu[0] : $argu;
$this->index[key($value)] = current($value);
}
} else {
$this->data = is_array($argu[0]) ? $argu[0] : $argu;
}
// @codeCoverageIgnoreEnd
return $this;
} elseif (in_array($upperKeyword, $this->selectFunctionKeyword)) {
/**
* Count
* @example count('log_ID')
* @example count('log_ID', 'countLogId')
* @example count(array('log_Id', 'countLogId'))
* @return [type] [description]
*/
if (count($argu) == 1) {
$arg = $argu[0];
if (is_string($arg)) {
$this->columns[] = "{$upperKeyword}({$arg})";
} else {
$this->columns[] = "{$upperKeyword}({$arg['0']}) AS {$arg['1']}";
}
} else {
$this->columns[] = "{$upperKeyword}({$argu['0']}) AS {$argu['1']}";
}
return $this;
} else {
$lowerKeyword = strtolower($callName);
if (is_callable($this, $lowerKeyword)) {
return call_user_func_array(array($this, $lowerKeyword), $argu);
}
}
// @codeCoverageIgnoreEnd
throw new Exception("Unimplemented {$callName}");
}