Skip to content

Instantly share code, notes, and snippets.

@slattery
Last active November 14, 2023 14:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slattery/43a790509f16c5e46101c9fa8ae87635 to your computer and use it in GitHub Desktop.
Save slattery/43a790509f16c5e46101c9fa8ae87635 to your computer and use it in GitHub Desktop.
bibcite-ris-ris-entity-bibtex-20231103-01.patch
diff --git a/modules/bibcite_bibtex/src/Encoder/BibtexEncoder.php b/modules/bibcite_bibtex/src/Encoder/BibtexEncoder.php
index a0ea233..e4f1307 100644
--- a/modules/bibcite_bibtex/src/Encoder/BibtexEncoder.php
+++ b/modules/bibcite_bibtex/src/Encoder/BibtexEncoder.php
@@ -22,14 +22,14 @@ class BibtexEncoder implements EncoderInterface, DecoderInterface {
/**
* {@inheritdoc}
*/
- public function supportsDecoding(string $format): bool {
+ public function supportsDecoding($format): bool {
return $format == static::$format;
}
/**
* {@inheritdoc}
*/
- public function decode(string $data, string $format, array $context = []): mixed {
+ public function decode($data, $format, array $context = []): mixed {
$data = $this->lineEndingsReplace($data);
/*
@@ -118,14 +118,14 @@ class BibtexEncoder implements EncoderInterface, DecoderInterface {
/**
* {@inheritdoc}
*/
- public function supportsEncoding(string $format): bool {
+ public function supportsEncoding($format): bool {
return $format == static::$format;
}
/**
* {@inheritdoc}
*/
- public function encode(mixed $data, string $format, array $context = []): string {
+ public function encode($data, $format, array $context = []): string {
if (isset($data['type'])) {
$data = [$data];
}
diff --git a/modules/bibcite_entity/src/Normalizer/CslReferenceNormalizer.php b/modules/bibcite_entity/src/Normalizer/CslReferenceNormalizer.php
index 0ec1fa0..f10e9d2 100644
--- a/modules/bibcite_entity/src/Normalizer/CslReferenceNormalizer.php
+++ b/modules/bibcite_entity/src/Normalizer/CslReferenceNormalizer.php
@@ -25,7 +25,7 @@ class CslReferenceNormalizer extends ReferenceNormalizerBase {
/**
* {@inheritdoc}
*/
- public function supportsDenormalization($data, string $type, string $format = NULL, array $context = []): bool {
+ public function supportsDenormalization($data, $type, $format = NULL): bool {
return FALSE;
}
diff --git a/modules/bibcite_ris/src/Encoder/RISEncoder.php b/modules/bibcite_ris/src/Encoder/RISEncoder.php
index 78cc087..f098e42 100644
--- a/modules/bibcite_ris/src/Encoder/RISEncoder.php
+++ b/modules/bibcite_ris/src/Encoder/RISEncoder.php
@@ -60,7 +60,7 @@ class RISEncoder implements EncoderInterface, DecoderInterface {
$record['EP'] = (array) $record['EP'];
}
$max_sp = array_key_exists('SP', $record) ? max($record['SP']) : NULL;
- $max_ep = array_key_exists('EP', $record) ? max($record['EP']) : 0;
+ $max_ep = array_key_exists('EP', $record) && is_int($record['EP']) ? max($record['EP']) : 0;
if ($max_sp && $max_sp > $max_ep) {
$pages_string .= $max_sp . '+';
array_splice($record['SP'], array_search($max_sp, $record['SP']), 1);
@@ -169,14 +169,14 @@ class RISEncoder implements EncoderInterface, DecoderInterface {
/**
* {@inheritdoc}
*/
- public function supportsEncoding(string $format): bool {
+ public function supportsEncoding($format): bool {
return $format == static::$format;
}
/**
* {@inheritdoc}
*/
- public function encode(mixed $data, string $format, array $context = []): string {
+ public function encode($data, $format, array $context = []): string {
if (isset($data['TY'])) {
$data = [$data];
}
diff --git a/src/HumanNameParser.php b/src/HumanNameParser.php
index eacdf9f..e4c4222 100644
--- a/src/HumanNameParser.php
+++ b/src/HumanNameParser.php
@@ -21,6 +21,7 @@ class HumanNameParser implements HumanNameParserInterface {
*/
public function __construct() {
$this->parser = new Parser([
+ 'mandatory_first_name' => FALSE,
'mandatory_last_name' => FALSE,
'mandatory_middle_name' => FALSE,
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment