public static function find(string $text) : Header
    {
        $matches = [];
        $parent = new Header();
        if (\preg_match_all(self::HEADERS_REGEX, $text, $matches, PREG_OFFSET_CAPTURE)) {
            foreach ($matches[0] as $index => $match) {
                $parent->append(new Header((int)$match[1], \strlen($match[0]), (int)$matches[1][$index][0], $matches[2][$index][0]));
            }
        }
        return $parent;
    }
public static function find(string $text) : Header
    {
        $matches = [];
        $parent = new Header();
        if (\preg_match_all(self::HEADERS_REGEX, $text, $matches, PREG_OFFSET_CAPTURE)) {
            foreach ($matches[0] as $index => $match) {
                $parent->append(new Header((int)$match[1], \strlen($match[0]), (int)$matches[1][$index][0], $matches[2][$index][0]));
            }
        }
        return $parent;
    }
public static function find ( string $ text ) : Header { $ matches = [ ] ; $ parent = new Header ( ) ; if ( \ preg_match_all ( self :: HEADERS_REGEX , $ text , $ matches , PREG_OFFSET_CAPTURE ) ) { foreach ( $ matches [ 0 ] as $ index => $ match ) { $ parent -> append ( new Header ( ( int ) $ match [ 1 ] , \ strlen ( $ match [ 0 ] ) , ( int ) $ matches [ 1 ] [ $ index ] [ 0 ] , $ matches [ 2 ] [ $ index ] [ 0 ] ) ) ; } } return $ parent ; }
Find all headers in text

Returned object is a virtual root object that does not exist in text.
Find all headers in text