当前位置: 首页>>代码示例>>PHP>>正文


PHP PhabricatorProject::setPhrictionSlug方法代码示例

本文整理汇总了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}'!");
     }
 }
开发者ID:neoxen,项目名称:phabricator,代码行数:33,代码来源:PhabricatorProjectEditor.php

示例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}'!");
     }
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:37,代码来源:PhabricatorProjectEditor.php


注:本文中的PhabricatorProject::setPhrictionSlug方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。