本文整理汇总了PHP中object::debug方法的典型用法代码示例。如果您正苦于以下问题:PHP object::debug方法的具体用法?PHP object::debug怎么用?PHP object::debug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类object
的用法示例。
在下文中一共展示了object::debug方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
/**
* Render a list of messages
*
* @param array $messages
* @return string
*/
public function render($messages = null)
{
if ($messages) {
$this->setMessages($messages);
}
$messages = $this->getMessages();
foreach ($messages as $item) {
$this->_logger->debug(print_r($item['var'], true));
}
}
示例2: request
/**
* {@inheritdoc}
*/
public function request($uri, $method = 'GET', $parameters = [], $headers = [])
{
$this->requestArguments = ['uri' => $uri, 'method' => $method, 'parameters' => $parameters, 'headers' => $headers];
$this->requestHeader = array_merge($this->requestHeader, $headers);
$response = null;
try {
if ('GET' == $method) {
$response = $this->client->get($uri, ['query' => $parameters, 'headers' => $this->requestHeader]);
}
if ('POST' == $method) {
$response = $this->client->post($uri, ['form_params' => $parameters, 'headers' => $this->requestHeader]);
}
} catch (\Exception $e) {
$response = $e->getResponse();
$this->responseClientError = $e->getMessage();
}
if (!$this->responseClientError) {
$this->responseBody = $response->getBody();
$this->responseHttpCode = $response->getStatusCode();
$this->responseHeader = $response->getHeaders();
}
if ($this->logger) {
$this->logger->debug("HttpClient\\Guzzle::request( {$uri}, {$method} ), response:", $this->getResponse());
if ($this->responseClientError) {
$this->logger->error("HttpClient\\Guzzle::request( {$uri}, {$method} ), GuzzleHttp error: ", [$this->responseClientError]);
}
}
return $this->responseBody;
}
示例3: request
/**
* {@inheritdoc}
*/
public function request($uri, $method = 'GET', $parameters = [], $headers = [])
{
$this->requestArguments = ['uri' => $uri, 'method' => $method, 'parameters' => $parameters, 'headers' => $headers];
$curl = curl_init();
if ('GET' == $method) {
unset($this->curlOptions[CURLOPT_POST]);
unset($this->curlOptions[CURLOPT_POSTFIELDS]);
$uri = $uri . (strpos($uri, '?') ? '&' : '?') . http_build_query($parameters);
}
if ('POST' == $method) {
$this->curlOptions[CURLOPT_POST] = true;
$this->curlOptions[CURLOPT_POSTFIELDS] = $parameters;
}
$this->requestHeader = array_merge($this->requestHeader, $headers);
$this->requestArguments['headers'] = $this->requestHeader;
$this->curlOptions[CURLOPT_URL] = $uri;
$this->curlOptions[CURLOPT_HTTPHEADER] = $this->prepareRequestHeaders();
$this->curlOptions[CURLOPT_HEADERFUNCTION] = [$this, 'fetchResponseHeader'];
foreach ($this->curlOptions as $opt => $value) {
curl_setopt($curl, $opt, $value);
}
$response = curl_exec($curl);
$this->responseBody = $response;
$this->responseHttpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
$this->responseClientError = curl_error($curl);
$this->responseClientInfo = curl_getinfo($curl);
if ($this->logger) {
$this->logger->debug("HttpClient\\Curl::request( {$uri}, {$method} ), response:", $this->getResponse());
if (false === $response) {
$this->logger->error("HttpClient\\Curl::request( {$uri}, {$method} ), curl_exec error: ", [$this->responseClientError]);
}
}
curl_close($curl);
return $this->responseBody;
}
示例4: echoMessage
/**
* Echo log message to CLI or web.
*
* @access private
*/
private function echoMessage()
{
if (!nZEDb_DEBUG) {
return;
}
// Check if this is CLI or web.
if ($this->outputCLI) {
echo $this->colorCLI->debug($this->logMessage);
} else {
echo '<pre>' . $this->logMessage . '</pre><br />';
}
}
示例5: fetch
/**
* Return an array of results given a query resource
*
* @param resource $result Result set to get results from
* @return array The results as an associative array
*/
function fetch($result)
{
// fetchRow() returns the row, NULL on no more data or a
// DB_Error, when an error occurs.
$row = $result->fetchRow();
// Always check that $result is not an error
if (DB::isError($row)) {
$this->foowd->debug('msg', $row->getMessage());
return FALSE;
}
return $row;
}
示例6: add
/**
* 增加一个cache项
*
* @param string $sKey
* @param mixed $mValue
* @param int $iTll
*/
public function add($sKey, $mValue, $iTll)
{
if ($this->oDebug) {
$iStartTime = microtime(true);
self::$iOptCnt++;
$ret = $this->oCache->add($sKey, $mValue, MEMCACHE_COMPRESSED, $iTll);
$iUseTime = microtime(true) - $iStartTime;
self::$iTotalTime += $iUseTime;
$this->oDebug->groupCollapsed('Memcache add ' . $sKey . ' :' . round($iUseTime * 1000, 2) . '毫秒');
$this->oDebug->debug($mValue);
$this->oDebug->groupEnd();
} else {
$ret = $this->oCache->add($sKey, $mValue, MEMCACHE_COMPRESSED, $iTll);
}
return $ret;
}
示例7: ksort
/**
* Check if an object is referenced in the object reference array.
*
* @access protected
* @param array indexes Array of indexes and values to find object by
* @param string source The source to fetch the object from
*/
function &checkLoadedReference($indexes, $source)
{
$this->db->getSource($source, $source, $tmp);
$hash = '';
ksort($indexes);
foreach ($indexes as $key => $value) {
if ($hash != '') {
$hash .= '_';
}
$hash .= $value;
}
$this->foowd->debug('msg', 'CHECK Hash: ' . $hash);
if (isset($this->objects[$source][$hash])) {
$this->foowd->debug('msg', 'CHECK Using exising loaded reference');
return $this->objects[$source][$hash];
}
return FALSE;
}
示例8: send
/**
* Send the request.
* @return Curl
* @throws PBMErrorException()
*/
protected function send()
{
$this->log->debug('Checking connection certificates.');
$this->checkCert($this->cainfo);
$this->checkCert($this->sslcert);
if (!$this->sslcertPwd) {
throw new PBMErrorException('Missing certificate password!');
}
switch (strtolower($this->type)) {
case 'get':
case 'delete':
if ($this->data) {
$this->url .= '?' . $this->data;
}
break;
case 'post':
case 'put':
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $this->data);
break;
default:
throw new PBMErrorException('Unsupported request type: ' . $this->type);
}
$curl_file = tempnam('', 'res');
$handle = fopen($curl_file, 'w');
if ($this->debug) {
curl_setopt($this->ch, CURLOPT_VERBOSE, true);
curl_setopt($this->ch, CURLOPT_STDERR, $handle);
}
$this->body = curl_exec($this->ch);
$this->status = curl_getinfo($this->ch, CURLINFO_HTTP_CODE);
if ($error = curl_errno($this->ch)) {
$this->log->error('cURL error code: ' . $error);
$this->log->error('cURL message: ' . curl_error($this->ch));
}
if ($this->debug) {
$this->log->debug('Curl result: ' . file_get_contents($curl_file));
}
fclose($handle);
unlink($curl_file);
return $this;
}
示例9: postProcess
/**
* Called after postTrigger
*
* @param object $event The event
* @return void
*/
private function postProcess(Event $event)
{
$skipped = false;
foreach ($this->dispatcher->getListeners($event) as $listener) {
if (!$listener instanceof TraceableListener) {
// A new listener was added during dispatch.
continue;
}
// Unwrap listener
//$this->dispatcher->removeListener($listener, $event);
//$this->dispatcher->addListener($listener->getWrappedListener(), $event);
$priority = $this->dispatcher->getListenerPriority($listener, $event);
$this->dispatcher->getListeners()[$event->getName()]->remove($listener);
$this->dispatcher->getListeners()[$event->getName()]->add($listener->getWrappedListener(), $priority);
$info = $this->getListenerInfo($listener->getWrappedListener(), $event->getName());
$eventName = $event->getName();
if ($listener->wasCalled()) {
if (null !== $this->logger) {
$this->logger->debug(sprintf('Notified event "%s" to listener "%s".', $eventName, $info['pretty']));
}
if (!isset($this->called[$eventName])) {
$this->called[$eventName] = new \SplObjectStorage();
}
$this->called[$eventName]->attach($listener);
}
if (null !== $this->logger && $skipped) {
$this->logger->debug(sprintf('Listener "%s" was not called for event "%s".', $info['pretty'], $eventName));
}
if ($listener->stoppedPropagation()) {
if (null !== $this->logger) {
$this->logger->debug(sprintf('Listener "%s" stopped propagation of the event "%s".', $info['pretty'], $eventName));
}
$skipped = true;
}
}
}
示例10: query
/**
* Execute a raw SQL query on the database.
*
* @param string $sql Raw SQL string to execute.
* @param array &$values Optional array of bind values
* @return mixed A result set object
*/
public function query($sql, &$values = [])
{
/* if ($this->logging)
{
$this->logger->log($sql);
if ($values)
{
$this->logger->log($values);
}
}
*
*/
if ($this->logging) {
$this->logger->debug($sql);
if ($values) {
$this->logger->logger->debug("Values:", $values);
}
}
$this->last_query = $sql;
try {
if (!($sth = $this->connection->prepare($sql))) {
throw new ExceptionDatabase($this);
}
} catch (\PDOException $e) {
throw new ExceptionDatabase($this);
}
$sth->setFetchMode(\PDO::FETCH_ASSOC);
try {
if (!$sth->execute($values)) {
throw new ExceptionDatabase($this);
}
} catch (\PDOException $e) {
throw new ExceptionDatabase($e);
}
return $sth;
}
示例11: _logMemoryUse
/**
* Logs memory use.
*/
private function _logMemoryUse()
{
if ($this->logger) {
$this->logger->debug(sprintf('Memory usage (currently) %dKB/ (max) %dKB', round(memory_get_usage(true) / 1024), memory_get_peak_usage(true) / 1024));
}
}
示例12: shouldRunJob
/**
* Determine if a job should be executed
*
* @param array $job
* @param object $logger
* @param float $timestamp
*
* @return bool
* @throws \Exception
*/
private static function shouldRunJob($job, $logger, $timestamp)
{
$expression = implode(" ", array($job['min'], $job['hour'], $job['dayofmonth'], $job['month'], $job['dayofweek'], $job['year']));
if (empty($job['lastrun'])) {
$next_calculated_run = (int) $job['firstrun'];
} else {
$last_date = date_create();
date_timestamp_set($last_date, (int) $job['lastrun']);
try {
$cron = CronExpression::factory($expression);
$next_calculated_run = $cron->getNextRunDate($last_date)->format('U');
} catch (Exception $e) {
$logger->error("Job " . $job['name'] . " cannot be executed due to cron parsing error", array("ERROR" => $e->getMessage(), "ERRID" => $e->getCode()));
return false;
}
}
$torun = $next_calculated_run <= $timestamp ? true : false;
$logger->debug("Job " . $job['name'] . ($torun ? " will be" : " will not be") . " executed", array("EXPRESSION" => $expression, "FIRSTRUNDATE" => date('c', $job['firstrun']), "LASTRUNDATE" => date('c', $job['lastrun']), "NEXTRUN" => date('c', $next_calculated_run)));
return $torun;
}
示例13: _exectue
/**
* 执行SQL
*
* @param string $sSQL
* @param array $aParam
* @param boolean $bStrictMaster
* @param boolean $bIsADU
* @return unknown
*/
protected function _exectue($sSQL, $aParam, $bStrictMaster, $bIsADU = false)
{
$iStartTime = microtime(true);
++self::$_iQueryCnt;
self::$_aSQLs[] = $this->_sLastSQL = $sSQL;
$db = $bStrictMaster ? $this->_getMasterDB() : $this->_getSlaveDB();
$this->_oSth = $db->prepare($sSQL);
if (!empty($aParam)) {
$this->_bindParams($aParam);
}
$bRet = $this->_oSth->execute();
if (false === $bRet) {
$sMsg = 'SQL Error: ' . $this->_formatSQL($sSQL, $aParam) . "\n";
$sMsg .= join("\n", $this->_oSth->errorInfo());
throw new Exception($sMsg);
return 0;
}
$iUseTime = round((microtime(true) - $iStartTime) * 1000, 2);
self::$_iUseTime += $iUseTime;
$iAffectedRows = $this->_oSth->rowCount();
if ($this->_oDebug) {
$this->_oDebug->debug('[DB->' . $this->_sDbName . ']: ' . $this->_formatSQL($sSQL, $aParam) . ' AffectedRows:' . $iAffectedRows . ' Use Time:' . $iUseTime . '毫秒');
}
// 记录增删改日志
if ($bIsADU) {
self::_addADUSQL('[DB->' . $this->_sDbName . ']: ' . $this->_formatSQL($sSQL, $aParam) . ' AffectedRows:' . $iAffectedRows . ' Use Time:' . $iUseTime . '毫秒');
}
if ($iAffectedRows > 0 && $bIsADU) {
$this->clearWhereCache();
}
return $iAffectedRows;
}
示例14:
function extract_title()
{
preg_match('~(</head>|<body>|(<title>\\s*(.*?)\\s*</title>))~i', $this->response, $m);
$this->e->debug("referer title extract: " . print_r($m, true));
return $m[3];
}
示例15: writeDebugLogByMsg
/**
* writeDebugLogByMsg
*
*
* @access private
* @author M.Ozeki
* @version $Id: IRJDisplayCommon_cls.php, v 1.0 2008/04/01 14:00 Exp $
* @return
*/
function writeDebugLogByMsg($sMsg)
{
$this->_oLogObj->debug($this->createMsg($sMsg));
}