reportFile = $reportFile; $this->rulesetFile = $rulesetFile; } /** * Whether the tool can be ran on the current environment * * @return bool */ public function canRun() { return class_exists('PHPMD\TextUI\Command'); } /** * {@inheritdoc} */ public function run(array $whiteList) { if (empty($whiteList)) { return \PHPMD\TextUI\Command::EXIT_SUCCESS; } $commandLineArguments = [ 'run_file_mock', //emulate script name in console arguments implode(',', $whiteList), 'text', //report format $this->rulesetFile, '--reportfile', $this->reportFile, ]; $options = new \PHPMD\TextUI\CommandLineOptions($commandLineArguments); $command = new \PHPMD\TextUI\Command(); return $command->run($options, new \PHPMD\RuleSetFactory()); } }