reportFile = $reportFile; $this->rulesetDir = $rulesetDir; $this->wrapper = $wrapper; } /** * {@inheritdoc} */ public function setExtensions(array $extensions) { $this->extensions = $extensions; } /** * Whether the tool can be ran on the current environment * * @return bool */ public function canRun() { return class_exists('PHP_CodeSniffer_CLI'); } /** * {@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; } }