src/Pop3.php
private function getHeaders($rawData)
    {
        if (is_string($rawData)) {
            $rawData = explode("\n", $rawData);
        }

        $key = null;
        $headers = array();
        foreach ($rawData as $line) {
            $line = trim($line);
            if (preg_match("/^([a-zA-Z0-9-]+):/i", $line, $matches)) {
                $key = strtolower($matches[1]);
                if (isset($headers[$key])) {
                    if (!is_array($headers[$key])) {
                        $headers[$key] = array($headers[$key]);
                    }

                    $headers[$key][] = trim(str_replace($matches[0], '', $line));
                    continue;
                }

                $headers[$key] = trim(str_replace($matches[0], '', $line));
                continue;
            }

            if (!is_null($key) && isset($headers[$key])) {
                if (is_array($headers[$key])) {
                    $headers[$key][count($headers[$key])-1] .= ' '.$line;
                    continue;
                }

                $headers[$key] .= ' '.$line;
            }
        }

        return $headers;
    }
private function getHeaders($rawData)
    {
        if (is_string($rawData)) {
            $rawData = explode("\n", $rawData);
        }

        $key = null;
        $headers = array();
        foreach ($rawData as $line) {
            $line = trim($line);
            if (preg_match("/^([a-zA-Z0-9-]+):/i", $line, $matches)) {
                $key = strtolower($matches[1]);
                if (isset($headers[$key])) {
                    if (!is_array($headers[$key])) {
                        $headers[$key] = array($headers[$key]);
                    }

                    $headers[$key][] = trim(str_replace($matches[0], '', $line));
                    continue;
                }

                $headers[$key] = trim(str_replace($matches[0], '', $line));
                continue;
            }

            if (!is_null($key) && isset($headers[$key])) {
                if (is_array($headers[$key])) {
                    $headers[$key][count($headers[$key])-1] .= ' '.$line;
                    continue;
                }

                $headers[$key] .= ' '.$line;
            }
        }

        return $headers;
    }
private function getHeaders ( $ rawData ) { if ( is_string ( $ rawData ) ) { $ rawData = explode ( "\n" , $ rawData ) ; } $ key = null ; $ headers = array ( ) ; foreach ( $ rawData as $ line ) { $ line = trim ( $ line ) ; if ( preg_match ( "/^([a-zA-Z0-9-]+):/i" , $ line , $ matches ) ) { $ key = strtolower ( $ matches [ 1 ] ) ; if ( isset ( $ headers [ $ key ] ) ) { if ( ! is_array ( $ headers [ $ key ] ) ) { $ headers [ $ key ] = array ( $ headers [ $ key ] ) ; } $ headers [ $ key ] [ ] = trim ( str_replace ( $ matches [ 0 ] , '' , $ line ) ) ; continue ; } $ headers [ $ key ] = trim ( str_replace ( $ matches [ 0 ] , '' , $ line ) ) ; continue ; } if ( ! is_null ( $ key ) && isset ( $ headers [ $ key ] ) ) { if ( is_array ( $ headers [ $ key ] ) ) { $ headers [ $ key ] [ count ( $ headers [ $ key ] ) - 1 ] .= ' ' . $ line ; continue ; } $ headers [ $ key ] .= ' ' . $ line ; } } return $ headers ; }
Returns email reponse headers
array key value format

@param *string $rawData The data to parse

@return array
Returns email reponse headers array key value format