public function __construct($file, array $listeners, array $ruleset, PHP_CodeSniffer $phpcs)
{
$this->_file = trim($file);
$this->_listeners = $listeners;
$this->ruleset = $ruleset;
$this->phpcs = $phpcs;
$this->fixer = new PHP_CodeSniffer_Fixer();
if (PHP_CODESNIFFER_INTERACTIVE === false) {
$cliValues = $phpcs->cli->getCommandLineValues();
if (isset($cliValues['showSources']) === true && $cliValues['showSources'] !== true) {
$recordErrors = false;
foreach ($cliValues['reports'] as $report => $output) {
$reportClass = $phpcs->reporting->factory($report);
if (property_exists($reportClass, 'recordErrors') === false || $reportClass->recordErrors === true) {
$recordErrors = true;
break;
}
}
$this->_recordErrors = $recordErrors;
}
}
}