public static function toHeaderLine($headers, $toString = false)
    {
        $headerArray = [];

        foreach ($headers as $key => $value) {
            $value = is_array($value) ? implode(',', $value) : $value;

            $headerArray[] = static::normalizeHeaderName($key) . ': ' . $value;
        }

        if ($toString) {
            $headerArray = implode($headerArray, "\r\n");
        }

        return $headerArray;
    }