/** * This method adds a violation to all reports for this violation type and * for the given <b>$node</b> instance. * * @param \PHPMD\AbstractNode $node * @param array $args * @param mixed $metric * @return void */ protected function addViolation(AbstractNode $node, array $args = array(), $metric = null) { $search = array(); $replace = array(); foreach ($args as $index => $value) { $search[] = '{' . $index . '}'; $replace[] = $value; } $message = str_replace($search, $replace, $this->message); $ruleViolation = new RuleViolation($this, $node, $message, $metric); $this->report->addRuleViolation($ruleViolation); }