public function applyHeraldEffects(array $effects)
 {
     assert_instances_of($effects, 'HeraldEffect');
     $result = array();
     foreach ($effects as $effect) {
         $action = $effect->getAction();
         switch ($action) {
             case self::ACTION_NOTHING:
                 $result[] = new HeraldApplyTranscript($effect, true, pht('Did nothing.'));
                 break;
             case self::ACTION_EMAIL:
                 foreach ($effect->getTarget() as $phid) {
                     $this->emailPHIDs[$phid] = $phid;
                 }
                 $result[] = new HeraldApplyTranscript($effect, true, pht('Added mailable to mail targets.'));
                 break;
             case self::ACTION_BLOCK:
                 $result[] = new HeraldApplyTranscript($effect, true, pht('Blocked push.'));
                 break;
             default:
                 $custom_result = parent::handleCustomHeraldEffect($effect);
                 if ($custom_result === null) {
                     throw new Exception(pht("No rules to handle action '%s'.", $action));
                 }
                 $result[] = $custom_result;
                 break;
         }
     }
     return $result;
 }
 public function applyHeraldEffects(array $effects)
 {
     assert_instances_of($effects, 'HeraldEffect');
     $result = array();
     foreach ($effects as $effect) {
         $action = $effect->getAction();
         switch ($action) {
             case self::ACTION_NOTHING:
                 $result[] = new HeraldApplyTranscript($effect, true, pht('Great success at doing nothing.'));
                 break;
             case self::ACTION_ADD_CC:
                 foreach ($effect->getTarget() as $phid) {
                     $this->ccPHIDs[] = $phid;
                 }
                 $result[] = new HeraldApplyTranscript($effect, true, pht('Added address to cc list.'));
                 break;
             case self::ACTION_FLAG:
                 $result[] = parent::applyFlagEffect($effect, $this->getMock()->getPHID());
                 break;
             default:
                 $custom_result = parent::handleCustomHeraldEffect($effect);
                 if ($custom_result === null) {
                     throw new Exception(pht("No rules to handle action '%s'.", $action));
                 }
                 $result[] = $custom_result;
                 break;
         }
     }
     return $result;
 }
 public function applyHeraldEffects(array $effects)
 {
     assert_instances_of($effects, 'HeraldEffect');
     $result = array();
     foreach ($effects as $effect) {
         $action = $effect->getAction();
         switch ($action) {
             case self::ACTION_NOTHING:
                 $result[] = new HeraldApplyTranscript($effect, true, pht('Great success at doing nothing.'));
                 break;
             case self::ACTION_EMAIL:
                 foreach ($effect->getTarget() as $phid) {
                     $this->emailPHIDs[$phid] = true;
                 }
                 $result[] = new HeraldApplyTranscript($effect, true, pht('Added address to email targets.'));
                 break;
             case self::ACTION_ADD_CC:
                 foreach ($effect->getTarget() as $phid) {
                     if (empty($this->addCCPHIDs[$phid])) {
                         $this->addCCPHIDs[$phid] = array();
                     }
                     $this->addCCPHIDs[$phid][] = $effect->getRuleID();
                 }
                 $result[] = new HeraldApplyTranscript($effect, true, pht('Added address to CC.'));
                 break;
             case self::ACTION_AUDIT:
                 foreach ($effect->getTarget() as $phid) {
                     if (empty($this->auditMap[$phid])) {
                         $this->auditMap[$phid] = array();
                     }
                     $this->auditMap[$phid][] = $effect->getRuleID();
                 }
                 $result[] = new HeraldApplyTranscript($effect, true, pht('Triggered an audit.'));
                 break;
             case self::ACTION_APPLY_BUILD_PLANS:
                 foreach ($effect->getTarget() as $phid) {
                     $this->buildPlans[] = $phid;
                 }
                 $result[] = new HeraldApplyTranscript($effect, true, pht('Applied build plans.'));
                 break;
             case self::ACTION_FLAG:
                 $result[] = parent::applyFlagEffect($effect, $this->commit->getPHID());
                 break;
             default:
                 $custom_result = parent::handleCustomHeraldEffect($effect);
                 if ($custom_result === null) {
                     throw new Exception(pht("No rules to handle action '%s'.", $action));
                 }
                 $result[] = $custom_result;
                 break;
         }
     }
     return $result;
 }