public function runCommand(RunApplicationCommand $command) { $command = $this->resolveCommandConfiguration($command); $this->excludedSniffDataCollector->addExcludedSniffs($command->getExcludedSniffs()); $this->createAndRegisterSniffsToSniffDispatcher($command->getStandards(), $command->getSniffs()); $this->runForSource($command->getSource(), $command->isFixer()); }
/** * @return Sniff|null */ public function create(string $sniffClassName) { if ($this->excludedSniffDataCollector->isSniffClassExcluded($sniffClassName)) { return null; } $sniff = new $sniffClassName(); return $this->setCustomSniffPropertyValues($sniff); }
/** * @return Sniff[] */ public function create(string $rulesetXmlFile) : array { $sniffs = $this->createSniffsFromOwnRuleset($rulesetXmlFile); $rulesetXml = simplexml_load_file($rulesetXmlFile); foreach ($rulesetXml->rule as $ruleXmlElement) { if ($this->isRuleXmlElementSkipped($ruleXmlElement)) { continue; } $this->excludedSniffDataCollector->collectFromRuleXmlElement($ruleXmlElement); $this->customSniffPropertyDataCollector->collectFromRuleXmlElement($ruleXmlElement); $sniffs = array_merge($sniffs, $this->sniffSetFactory->create($ruleXmlElement['ref'])); } return SniffSorter::sort($sniffs); }