function Hgblame::getAuthor
Extract the author from a blame line.
Parameters
string $line Line to parse.:
Return value
string|false String or FALSE if impossible to recover.
Overrides VersionControl::getAuthor
File
-
vendor/
squizlabs/ php_codesniffer/ src/ Reports/ Hgblame.php, line 33
Class
Namespace
PHP_CodeSniffer\ReportsCode
protected function getAuthor($line) {
$blameParts = [];
$line = preg_replace('|\\s+|', ' ', $line);
preg_match('|(.+[0-9]{2}:[0-9]{2}:[0-9]{2}\\s[0-9]{4}\\s.[0-9]{4}:)|', $line, $blameParts);
if (isset($blameParts[0]) === false) {
return false;
}
$parts = explode(' ', $blameParts[0]);
if (count($parts) < 6) {
return false;
}
$parts = array_slice($parts, 0, count($parts) - 6);
return trim(preg_replace('|<.+>|', '', implode(' ', $parts)));
}