Skip to content

Commit

Permalink
Fix Harry E. Wolff loading issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
demiankatz committed Aug 5, 2024
1 parent 46210c1 commit f93ec3d
Showing 1 changed file with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,20 @@ protected function extractSeries($series)
return empty($seriesInfo) ? false : $seriesInfo;
}

/**
* Is a "First Last" name equivalent to a "Last, Name" name?
*
* @param string $name First Last name
* @param string $invertedName Last, First name
*
* @return bool
*/
protected function nameIsInvertedName(string $name, string $invertedName): bool
{
$parts = explode(', ', $invertedName, 2);
return $name === $parts[1] . ' ' . $parts[0];
}

/**
* Extract publisher information.
*
Expand Down Expand Up @@ -192,7 +206,7 @@ protected function extractPublisher($mods, $authMods = [])
$authModsStr = (string)($authMods[0] ?? '');
if (
preg_match('/\(\d{4}/', $authModsStr)
|| strlen($authModsStr) > strlen($parts[0])
|| (strlen($authModsStr) > strlen($parts[0]) && !$this->nameIsInvertedName($parts[0], $authModsStr))
) {
$newParts = explode(',', $authModsStr);
foreach ($newParts as $i => $part) {
Expand Down

0 comments on commit f93ec3d

Please sign in to comment.