Skip to content

Commit a6f5b19

Browse files
committed
Fix parsing invalid href
1 parent 9cb2dff commit a6f5b19

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/Detectors/Languages.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public function detect(): array
1717
$language = $node->getAttribute('hreflang');
1818
$href = $node->getAttribute('href');
1919

20-
if (!$language || !$href) {
20+
if (isEmpty()) {
2121
continue;
2222
}
2323

@@ -26,4 +26,13 @@ public function detect(): array
2626

2727
return $languages;
2828
}
29+
30+
private function isEmpty($value): boolval
31+
{
32+
$skipValues = array(
33+
'undefined',
34+
);
35+
36+
return empty($value) || in_array($value, $skipValues);
37+
}
2938
}

0 commit comments

Comments
 (0)