public function determineOutputType() : string
    {
        $contentType = $this->getContentType();
        // set default
        $type = self::TYPE_HTML;
        if (is_string($contentType) && trim($contentType) !== ''
            // use regex match parameter
            // sort by priority type
            && preg_match(
                '`
                    (?P<'.self::TYPE_JSON.'>\/ja?son|js)
                    | (?P<'.self::TYPE_PLAIN.'>plain)
                    | (?P<'.self::TYPE_XML.'>application\/xml)
                    | (?P<'.self::TYPE_HTML.'>\/html)
                  `xi',
                $contentType,
                $match
            ) && !empty($match)
        ) {
            foreach ($match as $key => $value) {
                // if key is string that must be output
                if ($value && is_string($key)) {
                    return $key;
                }
            }
        } // else using default self::TYPE_HTML

        return $type;
    }