public function decorate(ClassLoader $classLoader) { $standards = $this->standardFinder->getStandards(); foreach ($standards as $stadardName => $standardRuleset) { if ($this->isDefaultStandard($stadardName)) { continue; } $standardNamespace = $this->detectStandardNamespaceFromStandardName($stadardName); $standardDir = dirname($standardRuleset); $classLoader->addPsr4($standardNamespace . '\\', $standardDir . DIRECTORY_SEPARATOR . $standardNamespace); } }
private function setAllowedValues(OptionsResolver $optionsResolver) { $optionsResolver->setAllowedValues(self::NAME, function (array $standards) { $standards = ValueNormalizer::normalizeCommaSeparatedValues($standards); $availableStandards = $this->standardFinder->getStandards(); foreach ($standards as $standardName) { if (!array_key_exists($standardName, $availableStandards)) { throw new StandardNotFoundException(sprintf('Standard "%s" is not supported. Pick one of: %s.', $standardName, implode(array_keys($availableStandards), ', '))); } } return true; }); }
public function create(string $standardName) : array { $rulesetXml = $this->standardFinder->getRulesetPathForStandardName($standardName); return $this->rulesetXmlToSniffsFactory->create($rulesetXml); }