protected function execute(InputInterface $input, OutputInterface $output) { $this->outputHeading($output, 'PHP Mess Detector on %s'); $files = $this->plugin->getFiles(Finder::create()->name('*.php')); if (count($files) === 0) { return $this->outputSkip($output); } $validate = new Validate(); $rules = realpath($validate->filePath($input->getOption('rules'))); $renderer = new MessDetectorRenderer($output, $this->moodle->directory); $renderer->setWriter(new StreamWriter(STDOUT)); $ruleSetFactory = new RuleSetFactory(); $ruleSetFactory->setMinimumPriority(5); $messDetector = new PHPMD(); $messDetector->processFiles(implode(',', $files), $rules, [$renderer], $ruleSetFactory); }
/** * @expectedException \InvalidArgumentException */ public function testFilePathIsDirectory() { $validate = new Validate(); $validate->filePath(__DIR__); }