RedBeanPHP\Logger\RDefault\Debug::log PHP Метод

log() публичный Метод

Takes a number of arguments tries to create a proper debug log based on the available data.
public log ( ) : void
Результат void
    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);
    }

Usage Example

Пример #1
0
 /**
  * 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();
 }
All Usage Examples Of RedBeanPHP\Logger\RDefault\Debug::log