Set the content type header

@var string $header
488051
public function setContentTypeHeader(string $header)
    {
        if (Validation::isValidContentType($header)) {
            $this->contentTypeHeader = $header;
        } else {
            throw new CustomException('Invalid content type');
        }
    }
738281
private function parseHeaderValues(string $header): HeaderValues
    {
        $headerLines = explode("\n", $header);

        $contentType = null;
        $wasAborted = true;
        $contentTypeString = '';

        foreach ($headerLines as $headerLine) {
            $keyValueParts = explode(':', $headerLine, 2);
            $key = strtolower($keyValueParts[0]);
            $value = $keyValueParts[1];

            if ('content-type' === $key) {
                $contentTypeString = trim($value);
                $contentTypeParser = new ContentTypeParser();

                try {
                    $contentType = $contentTypeParser->parse($contentTypeString);
                } catch (AttributeParserException $e) {
                } catch (SubtypeParserException $e) {
                } catch (TypeParserException $e) {
                }
            }

            if ('x-w3c-validator-status' === $key) {
                $status = strtolower(trim($value));

                if ('valid' === $status || 'invalid' === $status) {
                    $wasAborted = false;
                }
            }
        }

        if ($contentType instanceof InternetMediaTypeInterface) {
            return new HeaderValues($wasAborted, $contentType);
        }

        throw new InvalidContentTypeException($contentTypeString);
    }
745317
private function setHeader($header)
    {
        preg_match("'\[(.*?)\] 'si", $header, $match);
        if (!isset($match[1])) {
            throw new Exception('Unable to read datetime from header.');
        }
        $this->setDatetime($match[1]);

        $header = $this->cleanHeader($header);

        if (preg_match('/^[a-z]+.[A-Z]+:/', $header, $out)) {
            $this->setEnv($out[0]);
            $header = trim(str_replace($out[0], '', $header));
        }

        $this->header = $header;

        return $this;
    }
1272098
public function fileHeader($header)
    {
        $this->fileHeader = is_array($header) ? implode("\n", $header) : (string)$header;
        return $this;
    }
809807
public function setAcceptLanguageHeader(string $header)
    {
        if (Validation::isValidAcceptLanguage($header)) {
            $this->acceptLanguageHeader = $header;
        } else {
            throw new CustomException('Invalid accept language');
        }
    }
954818
private function setContent($content)
    {
        $this->content = $content;

        if (empty($this->contentType)) {
            return;
        }

        //Remove charset from Content-Type
        if (strpos($this->contentType, ';') !== false) {
            list($mime, $charset) = array_map('trim', explode(';', $this->contentType));

            $this->contentType = $mime;
            $charset = str_replace(['"', "'"], '', substr(strstr($charset, '='), 1));
            $this->content = Utils::toUtf8($content, trim($charset));
        }
    }
1121568
public function setContentType($contentType, $charset = null)
    {
        if ($charset === null) {
            $this->setHeader('Content-Type', $contentType);
        } else {
            $this->setHeader('Content-Type', $contentType . '; charset=' . $charset);
        }

        return $this;
    }
570232
public function setContentType($contentType)
    {
        $allowedTypes = array(
            'text/html',
            'text/xml',
            'text/htmlraw',
            'text/raw'
        );

        if (!in_array(strtolower($contentType), $allowedTypes)) {
            throw new \InvalidArgumentException(
                "Illegal content type, allowed content types are " . implode(', ', $allowedTypes)
            );
        }
        $this->contentType = $contentType;

        return $this;
    }
1178846
private function parseHeader($header) {
        if(!empty($header)) {
            $pos = strpos($header, ": ");

            if(false !== $pos) {
                $name = substr($header,0,$pos);
                $value = substr($header,$pos+2);

                $this->headers[$name] = $value;
            }
        }
    }
1070213
public function setContentType($contentType) {
    $this->contentType = $contentType;
    
    $ct = $this->contentType;
    if (isset($this->charset))
      $ct .= '; charset='.$this->charset;

    $this->setMeta('content-type',$ct, TRUE);
  }
545388
public function withHeader($header): object
    {
        if (is_array($header)) {
            foreach ($header as $value) {
                header($value);
            }
        } else {
            header($header);
        }
        return $this;
    }
990345
public function setContentType($content_type, $charset = null)
    {
        $this->params['content-type'] = $content_type;
        if ($charset !== null) {
            $this->setCharset($charset);
        }

        return $this;
    }
1135673
public function contentType($type = false)
    {

        if (headers_sent()) {
            if (self::$exceptOnHeaders) {
                throw new \Exception('Headers already sent. Content-type cannot be changed.');
            } else {
                return;
            }
        }

        if (!$type) {
            $type = "text/html";
        }

        self::$contentType = $type ."; charset=". strtolower(self::$charset);
        header("Content-Type: ". self::$contentType);
    }
660493
function setContentType( $type = false, $charset = false,
                             $transferEncoding = false, $disposition = false, $boundary = false )
    {
        if ( $type )
        {
            $this->ContentType['type'] = $type;
        }
        if ( $charset )
            $this->ContentType['charset'] = $charset;
        if ( $transferEncoding )
            $this->ContentType['transfer-encoding'] = $transferEncoding;
        if ( $disposition )
            $this->ContentType['disposition'] = $disposition;
        if ( $boundary )
            $this->ContentType['boundary'] = $boundary;

        // if the body was already defined
        if ( $this->Mail->body instanceof ezcMailText )
        {
            // if the content-type is in the form of e.g. 'text/plain'
            if ( strpos( $this->ContentType['type'] ,'/' ) !== false )
            {
                list( $type, $subType ) = explode( '/', $this->ContentType['type'] );
                $this->Mail->body->subType = $subType;
            }
        }
    }
362513
public static function setResponseHeaders($headers)
    {
        foreach ($headers as $name => $headerValues) {
            $header = $name . ": " . implode(", ", $headerValues);
            header($header);
        }
    }
1300248
function setHeaders($headers){
		$this->debug("setHeaders headers=");
		$this->appendDebug($this->varDump($headers));
		$this->requestHeaders = $headers;
	}
592848
public function setContentLanguageHeader(string $header)
    {
        if (Validation::isValidContentLanguage($header)) {
            $this->contentLanguageHeader = $header;
        } else {
            throw new CustomException('Invalid language');
        }
    }