本文整理汇总了PHP中PhabricatorProject::setPhrictionSlug方法的典型用法代码示例。如果您正苦于以下问题:PHP PhabricatorProject::setPhrictionSlug方法的具体用法?PHP PhabricatorProject::setPhrictionSlug怎么用?PHP PhabricatorProject::setPhrictionSlug使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhabricatorProject
的用法示例。
在下文中一共展示了PhabricatorProject::setPhrictionSlug方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: applyTransactionEffect
private function applyTransactionEffect(PhabricatorProject $project, PhabricatorProjectTransaction $xaction)
{
$type = $xaction->getTransactionType();
switch ($type) {
case PhabricatorProjectTransactionType::TYPE_NAME:
$project->setName($xaction->getNewValue());
$project->setPhrictionSlug($xaction->getNewValue());
$this->validateName($project);
break;
case PhabricatorProjectTransactionType::TYPE_STATUS:
$project->setStatus($xaction->getNewValue());
break;
case PhabricatorProjectTransactionType::TYPE_MEMBERS:
$old = array_fill_keys($xaction->getOldValue(), true);
$new = array_fill_keys($xaction->getNewValue(), true);
$this->addEdges = array_keys(array_diff_key($new, $old));
$this->remEdges = array_keys(array_diff_key($old, $new));
break;
case PhabricatorProjectTransactionType::TYPE_CAN_VIEW:
$project->setViewPolicy($xaction->getNewValue());
break;
case PhabricatorProjectTransactionType::TYPE_CAN_EDIT:
$project->setEditPolicy($xaction->getNewValue());
// You can't edit away your ability to edit the project.
PhabricatorPolicyFilter::mustRetainCapability($this->user, $project, PhabricatorPolicyCapability::CAN_EDIT);
break;
case PhabricatorProjectTransactionType::TYPE_CAN_JOIN:
$project->setJoinPolicy($xaction->getNewValue());
break;
default:
throw new Exception("Unknown transaction type '{$type}'!");
}
}
示例2: applyTransactionEffect
private function applyTransactionEffect(PhabricatorProject $project, PhabricatorProjectTransaction $xaction)
{
$type = $xaction->getTransactionType();
switch ($type) {
case PhabricatorProjectTransactionType::TYPE_NAME:
$project->setName($xaction->getNewValue());
$project->setPhrictionSlug($xaction->getNewValue());
$this->validateName($project);
break;
case PhabricatorProjectTransactionType::TYPE_STATUS:
$project->setStatus($xaction->getNewValue());
break;
case PhabricatorProjectTransactionType::TYPE_MEMBERS:
$old = array_fill_keys($xaction->getOldValue(), true);
$new = array_fill_keys($xaction->getNewValue(), true);
$add = array();
$rem = array();
foreach ($project->getAffiliations() as $affil) {
if (empty($new[$affil->getUserPHID()])) {
$rem[] = $affil;
}
}
foreach ($new as $phid => $ignored) {
if (empty($old[$phid])) {
$affil = new PhabricatorProjectAffiliation();
$affil->setRole('');
$affil->setUserPHID($phid);
$add[] = $affil;
}
}
$this->addAffiliations = $add;
$this->remAffiliations = $rem;
break;
default:
throw new Exception("Unknown transaction type '{$type}'!");
}
}