本文整理汇总了PHP中MWHttpRequest::getStatus方法的典型用法代码示例。如果您正苦于以下问题:PHP MWHttpRequest::getStatus方法的具体用法?PHP MWHttpRequest::getStatus怎么用?PHP MWHttpRequest::getStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MWHttpRequest
的用法示例。
在下文中一共展示了MWHttpRequest::getStatus方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: requestSuccessful
/**
* Check if a request to the ChillingEffects API was successful.
*
* @param MWHttpRequest $response The response from the API request.
* @return boolean
*/
public function requestSuccessful(\MWHttpRequest $response)
{
return $response->getStatus() === self::SUCCESSFUL_STATUS;
}
示例2: processServiceResponse
/**
* Returns results array with success and content elements
*
* @param MWHttpRequest $response
* @todo: how about extracting results to an object?
*/
private function processServiceResponse(MWHttpRequest $response)
{
$status = $response->getStatus();
$content = json_decode($response->getContent());
$success = $this->isSuccess($status, $content);
if (!$success && is_null($content)) {
$results['success'] = false;
$content = new stdClass();
$content->message = wfMessage('wikia-interactive-maps-service-error')->parse();
} else {
if (!$success && !is_null($content)) {
$results['success'] = false;
} else {
$results['success'] = true;
}
}
$results['content'] = $content;
return $results;
}