/** * @param string $path * @param string|null $configFile * @param AbstractLogger $logger * @return Result */ public function analyse($path, $configFile = null, AbstractLogger $logger = null) { $logger = $logger ?: new NullLogger(); $path = Path::makeAbsolute($path, getcwd()); if (!$configFile) { $configFile = Path::join([$path, '.simpspector.yml']); } $config = $this->loader->load($configFile); return $this->executor->run($path, $config, $logger); }
/** * @param string $path * @param AbstractLogger $logger * @return Result */ private function getResult($path, AbstractLogger $logger) { if (is_file($path)) { $logger->writeln(sprintf('import file "%s"', $path)); return $this->importer->import($path); } $file = Path::join($path, '.simpspector.yml'); $logger->writeln(sprintf('load config "%s"', $file)); $config = $this->loader->load($file); $logger->writeln('execute gadgets'); return $this->executor->run($path, $config, $logger); }