本文整理汇总了PHP中Statement::FromJSON方法的典型用法代码示例。如果您正苦于以下问题:PHP Statement::FromJSON方法的具体用法?PHP Statement::FromJSON怎么用?PHP Statement::FromJSON使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Statement
的用法示例。
在下文中一共展示了Statement::FromJSON方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: retrieveVoidedStatement
public function retrieveVoidedStatement($id)
{
$response = $this->sendRequest('GET', 'statements', array('params' => array('voidedStatementId' => $id)));
if ($response->success) {
$response->content = Statement::FromJSON($response->content);
}
return $response;
}
示例2: retrieveStatement
public function retrieveStatement($id, $options = array())
{
if (!isset($options['voided'])) {
$options['voided'] = false;
}
if (!isset($options['attachments'])) {
$options['attachments'] = false;
}
$params = array();
if ($options['voided']) {
$params['voidedStatementId'] = $id;
} else {
$params['statementId'] = $id;
}
if ($options['attachments']) {
$params['attachments'] = 'true';
}
$response = $this->sendRequest('GET', 'statements', array('params' => $params));
if ($response->success) {
if (is_array($response->content)) {
$orig = $response->httpResponse['_multipartContent'] = $response->content;
$response->content = Statement::FromJSON($orig[0]['body']);
$attachmentsByHash = array();
for ($i = 1; $i < count($orig); $i++) {
$attachmentsByHash[$orig[$i]['headers']['x-experience-api-hash']] = $orig[$i];
}
foreach ($response->content->getAttachments() as $attachment) {
$attachment->setContent($attachmentsByHash[$attachment->getSha2()]['body']);
}
} else {
$response->content = Statement::FromJSON($response->content);
}
}
return $response;
}