Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Hgblame.php

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

Hgblame

Namespace

PHP_CodeSniffer\Reports

Code

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)));
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal