示例#1
0
 /**
  * Run tool for files specified
  *
  * @param array $whiteList Files/directories to be inspected
  * @param array $blackList Files/directories to be excluded from the inspection
  * @param array $extensions Array of alphanumeric strings, for example: 'php', 'xml', 'phtml', 'css'...
  *
  * @return int
  */
 public function run(array $whiteList, array $blackList = array(), array $extensions = array())
 {
     $commandLineArguments = array('run_file_mock', implode(',', $whiteList), 'xml', $this->_rulesetFile, '--exclude', str_replace('/', DIRECTORY_SEPARATOR, implode(',', $blackList)), '--reportfile', $this->_reportFile);
     $options = new PHP_PMD_TextUI_CommandLineOptions($commandLineArguments);
     $command = new PHP_PMD_TextUI_Command();
     return $command->run($options);
 }
示例#2
0
 /**
  * Run tool for files specified
  *
  * @param array $whiteList Files/directories to be inspected
  * @param array $blackList Files/directories to be excluded from the inspection
  * @param array $extensions Array of alphanumeric strings, for example: 'php', 'xml', 'phtml', 'css'...
  *
  * @return int
  */
 public function run(array $whiteList, array $blackList = array(), array $extensions = array())
 {
     $commandLineArguments = array('run_file_mock', implode(',', $whiteList), 'xml', $this->_rulesetFile, '--exclude', implode(',', $blackList), '--reportfile', $this->_reportFile);
     $options = new \PHP_PMD_TextUI_CommandLineOptions($commandLineArguments);
     $command = new \PHP_PMD_TextUI_Command();
     return $command->run($options, new \PHP_PMD_RuleSetFactory());
 }
 /**
  * (non-PHPdoc)
  * @see MageUC_Console_Task::execute()
  */
 public function execute()
 {
     print '[phpmd] Lancement de PHPMD : ' . $this->getArgument('to_check') . PHP_EOL;
     $options = new PHP_PMD_TextUI_CommandLineOptions($this->_getOptions());
     $command = new PHP_PMD_TextUI_Command();
     $command->run($options);
     print '[phpmd] done' . PHP_EOL;
 }
示例#4
0
 /**
  * The main method that can be used by a calling shell script, the return
  * value can be used as exit code.
  *
  * @param array $args The raw command line arguments array.
  *
  * @return integer
  */
 public static function main(array $args)
 {
     try {
         $options = new PHP_PMD_TextUI_CommandLineOptions($args);
         $command = new PHP_PMD_TextUI_Command();
         $exitCode = $command->run($options);
     } catch (Exception $e) {
         fwrite(STDERR, $e->getMessage());
         fwrite(STDERR, PHP_EOL);
         $exitCode = self::EXIT_EXCEPTION;
     }
     return $exitCode;
 }
示例#5
0
文件: Command.php 项目: n2bh/phpmd
 /**
  * The main method that can be used by a calling shell script, the return
  * value can be used as exit code.
  *
  * @param array $args The raw command line arguments array.
  *
  * @return integer
  */
 public static function main(array $args)
 {
     try {
         $ruleSetFactory = new PHP_PMD_RuleSetFactory();
         $options = new PHP_PMD_TextUI_CommandLineOptions($args, $ruleSetFactory->listAvailableRuleSets());
         $command = new PHP_PMD_TextUI_Command();
         $exitCode = $command->run($options, $ruleSetFactory);
     } catch (Exception $e) {
         fwrite(STDERR, $e->getMessage());
         fwrite(STDERR, PHP_EOL);
         $exitCode = self::EXIT_EXCEPTION;
     }
     return $exitCode;
 }