本文整理汇总了PHP中Status::setResult方法的典型用法代码示例。如果您正苦于以下问题:PHP Status::setResult方法的具体用法?PHP Status::setResult怎么用?PHP Status::setResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Status
的用法示例。
在下文中一共展示了Status::setResult方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSetResult
/**
* @dataProvider provideSetResult
* @covers Status::setResult
*/
public function testSetResult($ok, $value = null)
{
$status = new Status();
$status->setResult($ok, $value);
$this->assertEquals($ok, $status->isOK());
$this->assertEquals($value, $status->getValue());
}
示例2:
/**
* Release the locks when this goes out of scope
*/
function __destruct() {
$wasOk = $this->status->isOK();
$this->status->merge( $this->manager->unlockByType( $this->pathsByType ) );
if ( $wasOk ) {
// Make sure status is OK, despite any unlockFiles() fatals
$this->status->setResult( true, $this->status->value );
}
}
示例3: onPageContentSave
/**
* @param $wikiPage
* @param \User $user
* @param $content
* @param $summary
* @param $isMinor
* @param $isWatch
* @param $section
* @param $flags
* @param \Status $status
*
* @return bool
*/
public function onPageContentSave($wikiPage, $user, $content, $summary, $isMinor, $isWatch, $section, $flags, $status)
{
if ($user && !$user->isEmailConfirmed()) {
if (!$this->testResponse()) {
$status->setResult(false);
$status->error("recaptcha-failed");
return false;
}
}
return true;
}
示例4: connectToFacebook
/**
* Map an existing Wikia user to a Facebook id
* If an exact or partial match of the map already exists, OR
* if creation of mapping does not succeed, returns not-OK Status
*
* @param int $wikiaUserId
* @param int $fbUserId
* @return \Status (status value will be null or \FacebookMapModel if successfully created)
*/
public function connectToFacebook($wikiaUserId, $fbUserId)
{
$status = new Status();
try {
$map = \FacebookMapModel::getUserMapping($wikiaUserId, $fbUserId);
if ($map) {
// Error! There is already a mapping
$status->setResult(false);
$status->error('fbconnect-error-already-connected');
} else {
$bizToken = \FacebookClient::getInstance()->getBizToken();
$map = \FacebookMapModel::createUserMapping($wikiaUserId, $fbUserId, $bizToken);
if ($map instanceof \FacebookMapModel) {
$status->setResult(true, $map);
} else {
$status->setResult(false);
$status->error('fbconnect-error');
}
}
} catch (\Exception $e) {
$messageParams = [];
switch ($e->getCode()) {
case \FacebookMapModel::ERROR_WIKIA_USER_ID_MISMATCH:
$messageParams[] = 'fbconnect-error-fb-account-in-use';
$messageParams[] = \User::whoIs($wikiaUserId);
break;
case \FacebookMapModel::ERROR_FACEBOOK_USER_ID_MISMATCH:
$messageParams[] = 'fbconnect-error-already-connected';
break;
default:
$messageParams[] = 'fbconnect-error';
}
$status->setResult(false);
call_user_func_array([$status, 'error'], $messageParams);
}
return $status;
}