本文整理汇总了PHP中State::setEtag方法的典型用法代码示例。如果您正苦于以下问题:PHP State::setEtag方法的具体用法?PHP State::setEtag怎么用?PHP State::setEtag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类State
的用法示例。
在下文中一共展示了State::setEtag方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: retrieveState
public function retrieveState($activity, $agent, $id)
{
if (!$activity instanceof Activity) {
$activity = new Activity($activity);
}
if (!$agent instanceof Agent) {
$agent = new Agent($agent);
}
$registration = null;
$requestCfg = array('params' => array('activityId' => $activity->getId(), 'agent' => json_encode($agent->asVersion($this->version)), 'stateId' => $id), 'ignore404' => true);
if (func_num_args() > 3) {
$options = func_get_arg(3);
if (isset($options)) {
if (isset($options['registration'])) {
$requestCfg['params']['registration'] = $registration = $options['registration'];
}
}
}
$response = $this->sendRequest('GET', 'activities/state', $requestCfg);
if ($response->success) {
$doc = new State(array('id' => $id, 'content' => $response->content, 'activity' => $activity, 'agent' => $agent));
if (isset($registration)) {
$doc->setRegistration($registration);
}
if (isset($response->httpResponse['headers']['lastModified'])) {
$doc->setTimestamp($response->httpResponse['headers']['lastModified']);
}
if (isset($response->httpResponse['headers']['contentType'])) {
$doc->setContentType($response->httpResponse['headers']['contentType']);
}
if (isset($response->httpResponse['headers']['etag'])) {
$doc->setEtag($response->httpResponse['headers']['etag']);
}
$response->content = $doc;
}
return $response;
}