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