예제 #1
0
 public function applyEffects(array $effects, HeraldObjectAdapter $object)
 {
     $this->transcript->setDryRun($object instanceof HeraldDryRunAdapter);
     $xscripts = $object->applyHeraldEffects($effects);
     foreach ($xscripts as $apply_xscript) {
         if (!$apply_xscript instanceof HeraldApplyTranscript) {
             throw new Exception("Heraldable must return HeraldApplyTranscripts from " . "applyHeraldEffect().");
         }
         $this->transcript->addApplyTranscript($apply_xscript);
     }
     if (!$this->transcript->getDryRun()) {
         // Mark all the rules that have had their effects applied as having been
         // executed for the current object.
         $rule_ids = mpull($xscripts, 'getRuleID');
         foreach ($rule_ids as $rule_id) {
             if (!$rule_id) {
                 // Some apply transcripts are purely informational and not associated
                 // with a rule, e.g. carryover emails from earlier revisions.
                 continue;
             }
             HeraldRule::saveRuleApplied($rule_id, $object->getPHID());
         }
     }
 }