Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $analyzerConfiguration = Analyzer\Factory::getPassesConfigurations();
     $configuration = new Configuration([], $analyzerConfiguration);
     $configTree = $configuration->getConfigTreeBuilder($analyzerConfiguration)->buildTree();
     $dumper = new YamlReferenceDumper();
     $output->writeln($dumper->dumpNode($configTree));
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $metaArray = Analyzer\Factory::getPassesMetadata();
     $output->writeln("# Analyzers");
     $output->writeln("This doc gives an overview about what the different analyzers do.");
     $output->writeln("");
     foreach ($metaArray as $analyzer) {
         $output->writeln("#### " . $analyzer->getName());
         $output->writeln("");
         $output->writeln($analyzer->getDescription());
         $output->writeln("");
     }
     $output->writeln("Next: [How To: Write own Analyzer](./06_HowTo_Own_Analyzer.md)");
 }
Exemplo n.º 3
0
 /**
  * @param string $analyzerName
  * @return EventManager
  * @throws \Webiny\Component\EventManager\EventManagerException
  */
 protected function getEventManager($analyzerName)
 {
     if (!class_exists($analyzerName, true)) {
         throw new \InvalidArgumentException("Analyzer with name: {$analyzerName} doesnot exist");
     }
     /** @var \PHPSA\Analyzer\Pass\Metadata $metaData */
     $metaData = $analyzerName::getMetadata();
     if (!$metaData->allowsPhpVersion(PHP_VERSION)) {
         parent::markTestSkipped(sprintf('We cannot tests %s with %s because PHP required version is %s', $analyzerName, PHP_VERSION, $metaData->getRequiredPhpVersion()));
     }
     $analyzerConfiguration = $metaData->getConfiguration();
     $analyzerConfiguration->attribute('enabled', true);
     $config = [$analyzerName::getMetadata()->getConfiguration()];
     $em = EventManager::getInstance();
     $configuration = new Configuration([], $config);
     \PHPSA\Analyzer\Factory::factory($em, $configuration);
     return $em;
 }
Exemplo n.º 4
0
 /**
  * @param string $configFile
  * @param string $configurationDirectory
  *
  * @return Configuration
  */
 protected function loadConfiguration($configFile, $configurationDirectory)
 {
     $loader = new ConfigurationLoader(new FileLocator([getcwd(), $configurationDirectory]));
     return new Configuration($loader->load($configFile), Analyzer\Factory::getPassesConfigurations());
 }