本文整理汇总了PHP中Guzzle\Http\Message\RequestInterface::getResourceUri方法的典型用法代码示例。如果您正苦于以下问题:PHP RequestInterface::getResourceUri方法的具体用法?PHP RequestInterface::getResourceUri怎么用?PHP RequestInterface::getResourceUri使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Guzzle\Http\Message\RequestInterface
的用法示例。
在下文中一共展示了RequestInterface::getResourceUri方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: log
/**
* Log a message based on a request and response
*
* @param RequestInterface $request Request to log
* @param Response $response Response to log
*/
private function log(RequestInterface $request, Response $response = null)
{
$message = '';
if ($this->settings & self::LOG_CONTEXT) {
// Log common contextual information
$message = $request->getHost() . ' - "' . $request->getMethod() . ' ' . $request->getResourceUri() . ' ' . strtoupper($request->getScheme()) . '/' . $request->getProtocolVersion() . '"';
// If a response is set, then log additional contextual information
if ($response) {
$message .= sprintf(' - %s %s - %s %s %s', $response->getStatusCode(), $response->getContentLength() ?: 0, $response->getInfo('total_time'), $response->getInfo('speed_upload'), $response->getInfo('speed_download'));
}
}
// Check if we are logging anything that will come from cURL
if ($request->getParams()->get('curl_handle') && ($this->settings & self::LOG_DEBUG || $this->settings & self::LOG_HEADERS || $this->settings & self::LOG_BODY)) {
// If context logging too, then add a new line for cleaner messages
if ($this->settings & self::LOG_CONTEXT) {
$message .= "\n";
}
// Filter cURL's verbose output based on config settings
$message .= $this->parseCurlLog($request);
// Log the response body if the response is available
if ($this->settings & self::LOG_BODY && $response) {
if ($request->getParams()->get('response_wire')) {
$message .= (string) $request->getParams()->get('response_wire');
} else {
$message .= $response->getBody(true);
}
}
}
// Send the log message to the adapter, adding a category and host
$priority = $response && !$response->isSuccessful() ? LOG_ERR : LOG_DEBUG;
$this->logAdapter->log(trim($message), $priority, array('category' => 'guzzle.request', 'host' => $this->hostname));
}