diff --git a/src/InPageNavigation.php b/src/InPageNavigation.php index d2ba1bb..92fe879 100644 --- a/src/InPageNavigation.php +++ b/src/InPageNavigation.php @@ -11,9 +11,10 @@ private function parseHeading(string $html): object { $matches = []; preg_match('/(id=")(.*?)"/', $html, $matches); + $tmp_id = (isset($matches[2])) ? $matches[2] : ''; return (object) [ 'title' => trim(strip_tags($html)), - 'id' => $matches[2] + 'id' => $tmp_id ]; }