public function log()
{
if (func_num_args() < 1) {
return;
}
$sql = func_get_arg(0);
if (func_num_args() < 2) {
$bindings = array();
} else {
$bindings = func_get_arg(1);
}
if (!is_array($bindings)) {
return $this->output($sql);
}
$newSql = $this->normalizeSlots($sql);
$newBindings = $this->normalizeBindings($bindings);
$newStr = $this->writeQuery($newSql, $newBindings);
$this->output($newStr);
}
/** * Performs a test. * Given a query, a set of bindings and an expected outcome, * this method tests the result of the debugger. * * @param string $query * @param mixed $bindings * @param string $expected * * @return void */ private function testDebug($query, $bindings = NULL, $expected) { $debugger = new Debugger(); $debugger->setMode(1); if (!is_null($bindings)) { $debugger->log($query, $bindings); } else { $debugger->log($query); } $logs = $debugger->getLogs(); $log = reset($logs); asrt($log, $expected); $debugger->clear(); }