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);
    }