protected function checkFileInternal(CheckContext $checkContext, Config $config)
{
$file = $checkContext->getFile();
$lines = $file->getLines();
$severityError = Violation::SEVERITY_ERROR;
$severityWarning = Violation::SEVERITY_WARNING;
$severityInfo = Violation::SEVERITY_INFO;
if (count($lines) > 0) {
$this->setLimit($severityError, $config->get('error_limit', $this->limits[$severityError]));
$this->setLimit($severityWarning, $config->get('warning_limit', $this->limits[$severityWarning]));
$this->setLimit($severityInfo, $config->get('info_limit', $this->limits[$severityInfo]));
$this->setTabExpand($config->get('tab_expand', $this->tabExpand));
foreach ($lines as $line => $data) {
$lineLength = iconv_strlen(str_replace("\t", str_repeat(' ', $this->tabExpand), rtrim($data, "\r\n")), $file->getEncoding());
$severity = null;
foreach (Violation::getSeverities() as $severity) {
if (!isset($this->limits[$severity]) || $this->limits[$severity] === null) {
continue;
}
if ($lineLength <= $this->limits[$severity]) {
continue;
}
$this->addViolation($file, $line, 0, sprintf('Line is too long. [%d/%d]', $lineLength, $this->limits[$severity]), $severity);
}
}
}
}