Skip to content

Commit

Permalink
FDR-399: Switch to regex
Browse files Browse the repository at this point in the history
  • Loading branch information
bibliophileaxe committed Feb 1, 2024
1 parent f9d3647 commit 1f7da32
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Form/SelectCslForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
];

// Log error message.
$this->logger->error($csl);
$this->logger->error(json_encode($csl));

return $form;
}
Expand Down Expand Up @@ -225,7 +225,7 @@ public function getDefaultCitation($csl_name) {
try {
// Method call to render citation.
$rendered = $this->renderCitation($csl_name);
return $rendered['data'];
return $rendered['data'] ?? NULL;
}
catch (\Throwable $e) {
return $e->getMessage();
Expand Down
2 changes: 1 addition & 1 deletion src/Normalizer/NormalizerBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ protected function getNameParts(string $name): array {
$firstName = trim(preg_replace('#' . preg_quote($lastName, '#') . '#', '', $name));
}

if (empty($firstName) && empty($lastName)) {
if (empty($firstName) || empty($lastName)) {
throw new \Exception('Name is not formatted properly');
}

Expand Down

0 comments on commit 1f7da32

Please sign in to comment.