From 51de53c86db6967936afbef5033de4d3164a125d Mon Sep 17 00:00:00 2001 From: Stefan Hagspiel Date: Thu, 21 Sep 2023 13:47:11 +0200 Subject: [PATCH] fix phpstan issues --- src/Normalizer/LocalizedResourceNormalizer.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Normalizer/LocalizedResourceNormalizer.php b/src/Normalizer/LocalizedResourceNormalizer.php index 584283e..0798c54 100644 --- a/src/Normalizer/LocalizedResourceNormalizer.php +++ b/src/Normalizer/LocalizedResourceNormalizer.php @@ -44,11 +44,12 @@ protected function normalizePage(ContextDefinitionInterface $contextDefinition, $documentLocale = $document->getProperty('language'); if (empty($documentLocale)) { + if ($this->options['skip_not_localized_documents'] === false) { throw new NormalizerException(sprintf('Cannot determinate locale aware document id "%s": no language property given.', $document->getId())); - } else { - return []; } + + return []; } $documentId = sprintf('%s_%s_%d', 'document', $documentLocale, $document->getId()); @@ -141,14 +142,11 @@ protected function generateResourceMetaFromHtmlResource(SpiderResource $resource $contentLanguage = strtolower(str_replace('-', '_', $contentLanguage)); if (empty($contentLanguage)) { + if ($this->options['skip_not_localized_documents'] === false) { throw new NormalizerException(sprintf('Cannot determinate locale aware document id "%s": no language property given.', $resourceId)); - } else { - return null; } - } - if (empty($contentLanguage)) { return null; }