Esempio n. 1
0
 /**
  * {@inheritdoc}
  */
 public function run(array $whiteList)
 {
     if (empty($whiteList)) {
         return 0;
     }
     $this->wrapper->checkRequirements();
     $settings = $this->wrapper->getDefaults();
     $settings['files'] = $whiteList;
     $settings['standard'] = [$this->rulesetDir];
     $settings['extensions'] = $this->extensions;
     $settings['warningSeverity'] = 0;
     $settings['reports']['full'] = $this->reportFile;
     $this->wrapper->setValues($settings);
     ob_start();
     $result = $this->wrapper->process();
     ob_end_clean();
     return $result;
 }
Esempio n. 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'...
  * @param int $warningSeverity Severity level of warnings, default is 0
  *
  * @return int
  */
 public function run(array $whiteList, array $blackList = array(), array $extensions = array(), $warningSeverity = 0)
 {
     $whiteList = array_map(function ($item) {
         return $item;
     }, $whiteList);
     $blackList = array_map(function ($item) {
         return preg_quote($item);
     }, $blackList);
     $this->wrapper->checkRequirements();
     $settings = $this->wrapper->getDefaults();
     $settings['files'] = $whiteList;
     $settings['standard'] = [$this->rulesetDir];
     $settings['ignored'] = $blackList;
     $settings['extensions'] = $extensions;
     $settings['reportFile'] = $this->reportFile;
     $settings['warningSeverity'] = $warningSeverity;
     $settings['reports']['checkstyle'] = null;
     $this->wrapper->setValues($settings);
     ob_start();
     $result = $this->wrapper->process();
     ob_end_clean();
     return $result;
 }