diff --git a/vendor/embed/embed/src/Detectors/Languages.php b/vendor/embed/embed/src/Detectors/Languages.php index 54780bc4..6fbe4e33 100644 --- a/vendor/embed/embed/src/Detectors/Languages.php +++ b/vendor/embed/embed/src/Detectors/Languages.php @@ -3,6 +3,8 @@ declare(strict_types = 1); namespace Embed\Detectors; +use function Embed\isEmpty; + class Languages extends Detector { /** @@ -17,7 +19,7 @@ class Languages extends Detector $language = $node->getAttribute('hreflang'); $href = $node->getAttribute('href'); - if (!$language || !$href) { + if (isEmpty($language, $href)) { continue; } diff --git a/vendor/embed/embed/src/functions.php b/vendor/embed/embed/src/functions.php index 66edc09f..626833b5 100644 --- a/vendor/embed/embed/src/functions.php +++ b/vendor/embed/embed/src/functions.php @@ -132,3 +132,25 @@ function getDirectory(string $path, int $position): ?string $dirs = explode('/', $path); return $dirs[$position + 1] ?? null; } + +/** + * Determine whether at least one of the supplied variables is empty. + * + * @param mixed ...$values The values to check. + * + * @return boolean + */ +function isEmpty(mixed ...$values): bool +{ + $skipValues = array( + 'undefined', + ); + + foreach ($values as $value) { + if (empty($value) || in_array($value, $skipValues)) { + return true; + } + } + + return false; +}