public static function parse($input)
    {
        $headers = new HttpHeaders();

        if (is_null($input) || empty($input))
        {
            return $headers;
        }

        $lines = preg_split('/\R/', $input);

        foreach ($lines as $header)
        {
            $elements = explode(':', $header, 2);

            if (count($elements) === 2)
            {
                $name  = trim($elements[0]);
                $value = trim($elements[1]);
                $headers->add($name, $value);
            }
        }

        return $headers;
    }