Skip to content

Commit

Permalink
Merge pull request #512 from jikan-me/enhancement/person/given-name
Browse files Browse the repository at this point in the history
Person: Given name set as null if empty
  • Loading branch information
irfan-dahir authored Apr 14, 2023
2 parents 0ea3b62 + d85489f commit e64a336
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Parser/Person/PersonParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,15 @@ public function getPersonGivenName(): ?string
return null;
}

return JString::cleanse(
$givenName = JString::cleanse(
str_replace($node->text(), '', $node->ancestors()->text())
);

if (empty($givenName)) {
return null;
}

return $givenName;
}

/**
Expand Down

0 comments on commit e64a336

Please sign in to comment.