本文整理汇总了PHP中HWI\Bundle\OAuthBundle\OAuth\ResourceOwner\GenericOAuth2ResourceOwner::getResponseContent方法的典型用法代码示例。如果您正苦于以下问题:PHP GenericOAuth2ResourceOwner::getResponseContent方法的具体用法?PHP GenericOAuth2ResourceOwner::getResponseContent怎么用?PHP GenericOAuth2ResourceOwner::getResponseContent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HWI\Bundle\OAuthBundle\OAuth\ResourceOwner\GenericOAuth2ResourceOwner
的用法示例。
在下文中一共展示了GenericOAuth2ResourceOwner::getResponseContent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getResponseContent
/**
* {@inheritDoc}
*/
public function getResponseContent(HttpMessageInterface $rawResponse)
{
$content = $rawResponse->getContent();
if (preg_match('/^callback\\((.+)\\);$/', $content, $matches)) {
$rawResponse->setContent(trim($matches[1]));
}
return parent::getResponseContent($rawResponse);
}
示例2: getResponseContent
/**
* {@inheritDoc}
*/
protected function getResponseContent(HttpMessageInterface $rawResponse)
{
$response = parent::getResponseContent($rawResponse);
// Foursquare use quite custom response structure in case of error
if (isset($response['meta']['errorType'])) {
// Prevent to mark deprecated calls as errors
if (200 == $response['meta']['code']) {
$response['error'] = $response['meta']['errorType'];
// Try to add some details of error if available
if (isset($response['meta']['errorMessage'])) {
$response['error'] .= ' ' . $response['meta']['errorMessage'];
} elseif (isset($response['meta']['errorDetail'])) {
$response['error'] .= ' ' . $response['meta']['errorDetail'];
}
}
unset($response['meta']);
}
return $response;
}