private static function parse(string $headers): array
    {
        $header  = [];
        $matches = [];
        preg_match_all(
                '=^(.[^: ]+): ([^\r\n]*)=m',
                $headers,
                $matches,
                PREG_SET_ORDER
        );
        foreach ($matches as $line) {
            $header[$line[1]] = $line[2];
        }

        return $header;
    }
private static function parse(string $headers): array
    {
        $header  = [];
        $matches = [];
        preg_match_all(
                '=^(.[^: ]+): ([^\r\n]*)=m',
                $headers,
                $matches,
                PREG_SET_ORDER
        );
        foreach ($matches as $line) {
            $header[$line[1]] = $line[2];
        }

        return $header;
    }
private static function parse ( string $ headers ) : array { $ header = [ ] ; $ matches = [ ] ; preg_match_all ( '=^(.[^: ]+): ([^\r\n]*)=m' , $ headers , $ matches , PREG_SET_ORDER ) ; foreach ( $ matches as $ line ) { $ header [ $ line [ 1 ] ] = $ line [ 2 ] ; } return $ header ; }
parses given header string and returns a list of headers

@param   string  $headers
@return  array
parses given header string and returns a list of headers