本文整理匯總了PHP中UUID::fromBin方法的典型用法代碼示例。如果您正苦於以下問題:PHP UUID::fromBin方法的具體用法?PHP UUID::fromBin怎麽用?PHP UUID::fromBin使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UUID
的用法示例。
在下文中一共展示了UUID::fromBin方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: newFromDatabaseRow
public static function newFromDatabaseRow(\stdClass $row)
{
$id = UUID::fromBin($row->flowthread_id);
// This is either NULL or a binary UUID
$parentid = $row->flowthread_parentid;
if ($parentid !== null) {
$parentid = UUID::fromBin($parentid);
}
$data = array('id' => $id, 'pageid' => intval($row->flowthread_pageid), 'userid' => intval($row->flowthread_userid), 'username' => $row->flowthread_username, 'text' => $row->flowthread_text, 'parentid' => $parentid, 'status' => intval($row->flowthread_status), 'like' => intval($row->flowthread_like), 'report' => intval($row->flowthread_report));
return new self($data);
}
示例2: batchGetUserAttitude
public static function batchGetUserAttitude(\User $user, array $posts)
{
if (!count($posts)) {
return array();
}
$dbr = wfGetDB(DB_SLAVE);
$inExpr = self::buildPostInExpr($dbr, $posts);
$res = $dbr->select('FlowThreadAttitude', array('flowthread_att_id', 'flowthread_att_type'), array('flowthread_att_id' . $inExpr, 'flowthread_att_userid' => $user->getId()));
$ret = array();
foreach ($res as $row) {
$ret[UUID::fromBin($row->flowthread_att_id)->getHex()] = intval($row->flowthread_att_type);
}
foreach ($posts as $post) {
if (!isset($ret[$post->id->getHex()])) {
$ret[$post->id->getHex()] = Post::ATTITUDE_NORMAL;
}
}
return $ret;
}
示例3: formatPayload
protected function formatPayload($payload, $event, $user)
{
switch ($payload) {
case 'text':
try {
return Post::newFromId(UUID::fromBin($event->getExtraParam('postid')))->text;
} catch (\Exception $e) {
return wfMessage('notification-flowthread-payload-error');
}
default:
return parent::formatPayload($payload, $event, $user);
break;
}
}