'No License Header', ); } public function lintPath($path) { $working_copy = $this->getEngine()->getWorkingCopy(); $copyright_holder = $working_copy->getConfig('copyright_holder'); if (!$copyright_holder) { return; } $year = date('Y'); $maybe_php_or_script = '(#![^\n]+?[\n])?(<[?]php\s+?)?'; $patterns = array( "@^{$maybe_php_or_script}//[^\n]*Copyright[^\n]*[\n]\s*@i", "@^{$maybe_php_or_script}/[*].*?Copyright.*?[*]/\s*@is", "@^{$maybe_php_or_script}\s*@", ); $license = <<getData($path); $matches = 0; if (preg_match($pattern, $data, $matches)) { $expect = rtrim(implode('', array_slice($matches, 1)))."\n\n".$license; $expect = ltrim($expect); if (rtrim($matches[0]) != rtrim($expect)) { $this->raiseLintAtOffset( 0, self::LINT_NO_LICENSE_HEADER, 'This file has a missing or out of date license header.', $matches[0], $expect); } break; } } } }