/** * Run Flitch. * * @param array $arguments * @return void */ public function run(array $arguments) { echo "Flitch " . Version::getVersion() . " by Ben Scholzen 'DASPRiD'\n\n"; $parser = new ArgumentParser($arguments, array(array('code' => 's', 'name' => 'standard', 'has_arg' => true), array('code' => 'c', 'name' => 'checkstyle', 'has_arg' => true), array('code' => 'q', 'name' => 'quiet', 'has_arg' => false), array('code' => 'h', 'name' => 'help', 'has_arg' => false), array('code' => 'v', 'name' => 'version', 'has_arg' => false))); if ($parser->getError() !== null) { echo $parser->getError() . "\n"; return; } $method = 'analyzeFiles'; foreach ($parser->getOptions() as $option) { switch ($option['code']) { case 's': $this->standard = $option['argument']; break; case 'c': $this->checkstyleReportFilename = $option['argument']; break; case 'q': $this->quiet = true; break; case 'h': $method = 'printHelp'; break; case 'v': return; } } foreach ($parser->getNonOptions() as $nonOption) { $this->paths[] = $nonOption; } $this->{$method}(); }