add a mime type which this route supports

@param   string  $mimeType
@param   string  $class     optional  special class to be used for given mime type on this route
@return  \stubbles\webapp\routing\Route
@throws  \InvalidArgumentException
504669
public function supportsMimeType(string $mimeType, string $class = null): ConfigurableRoute
    {
        if (null === $class && !SupportedMimeTypes::provideDefaultClassFor($mimeType)) {
            throw new \InvalidArgumentException(
                    'No default class known for mime type ' . $mimeType
                    . ', please provide a class'
            );
        }

        $this->mimeTypes[] = $mimeType;
        if (null !== $class) {
            $this->mimeTypeClasses[$mimeType] = $class;
        }

        return $this;
    }
816542
public function setMimeType(string $mime_type) {
        if(!$this->setModified('mime_type', $mime_type)->isModified()) {
            return $this;
        }
		$this->mime_type = $mime_type;
		return $this;
    }
1031739
public static function set_class_for_file_extension($exts, $class)
    {
        if (!is_array($exts)) {
            $exts = array($exts);
        }
        foreach ($exts as $ext) {
            if (!is_subclass_of($class, File::class)) {
                throw new InvalidArgumentException(
                    sprintf('Class "%s" (for extension "%s") is not a valid subclass of File', $class, $ext)
                );
            }
            self::config()->merge('class_for_file_extension', [$ext => $class]);
        }
    }
654890
public static function addDecoder(string $class, string ...$contentTypes)
    {
        $interface = decoder\DecoderInterface::class;
        if (!is_subclass_of($class, $interface)) {
            throw new \InvalidArgumentException(
                "invalid value provided for 'class'; ".
                "expecting the name of a class that implements '$interface'"
            );
        }

        foreach ($contentTypes as $type) {
            static::$decoders[$class] = $type;
        }
    }
570482
public function setMimeType($mimeType)
    {
        if (!in_array($mimeType, $this->knownMimetypes)) {
            throw new UnsupportedParameterException("I cannot handle mimetype '$mimeType', only " . implode(',', $this->knownMimetypes ));
        }

        $this->mimeType = $mimeType;

        return $this;
    }
728748
public function compose($body = null, $mimeType = null)
    {
        // Supported types are null, ViewModel and string.
        if (null !== $body && !is_string($body) && !($body instanceof ViewModel)) {
            throw new InvalidArgumentException(
                'Invalid value supplied. Expected null, string or instance of Zend\View\Model\ViewModel.'
            );
        }

        $body    = $this->manipulateBody($body, $mimeType);
        $message = new Message;

        $message->setBody($body);

        if ($this->config['message']['generate_alternative_body'] && count($body->getParts()) > 1) {
            $message->getHeaders()->get('content-type')->setType('multipart/alternative');
        }

        $this->applyMessageHeaders($message);
        $this->applyMessageOptions($message);

        return $message;
    }
761272
public function addClass($class)
    {
        if (is_array($class)) {
            foreach ($class as $c) {
                $this->addClass($class);
            }

            return $this;
        }
        $this->template->append('class', ' '.$class);

        return $this;
    }
649444
public function setProvider($class, $provider)
    {

        ltrim($class, '\\');

        if ($provider instanceof Provider) {
            $this->providers[$class] = $provider;
            return $this;
        }

        if (is_callable($provider)) {
            $this->providerFactories[$class] = $provider;
            return $this;
        }

        if (!is_string($provider)) {
            throw new InvalidArgumentException("Provider has to be callable, Provider or a class name.");
        }

        $this->providerFactories[$class] = function () use ($provider) {
            return $this->createObject($provider);
        };

        return $this;
    }
1231764
public function addMapping($contentType, $dataClass) {
        if ( ! class_exists($dataClass)
            || ! array_contains(class_implements($dataClass), IHttpData::class)) {
            throw new InvalidDataClassException(
                s('Class "%s" must implement the "%s" interface.',
                    $dataClass, IHttpData::class)
            );
        }

        $this->mappings[$contentType] = $dataClass;
    }
742679
public static function getByMimeType(?string $mimeType): int
    {
        switch (explode('/', (string) $mimeType)[0] ?? null) {
            case 'image':
                return static::IMAGE;
            case 'audio':
                return static::AUDIO;
            case 'video':
                return static::VIDEO;
            default:
                return static::FILE;
        }
    }
163875
public function addMimeType($mimeType)
    {
        if (!in_array($mimeType, $this->mimeTypes)) {
            $this->mimeTypes[] = $mimeType;
        }

        return $this;
    }
1306713
public function mimeType($type, $val = '')
    {
        if (is_array($type)) {
            $this->mimeType = array_merge($this->mimeType, $type);
        } else {
            $this->mimeType[$type] = $val;
        }
    }
192023
public function addType($type)
    {
        if (!in_array($type, $this->validTypes())) {
            throw new InvalidArgumentException(
                sprintf('Invalid cache type: "%s"', $type)
            );
        }

        $this->types[$type] = true;
        return $this;
    }
49365
public static function createFromPath(string $path)
    {
        $createFunctions = [
            'image/png' => 'imagecreatefrompng',
            'image/jpeg' => 'imagecreatefromjpeg',
            'image/gif' => 'imagecreatefromgif',
        ];

        $mimeType = mime_content_type($path);

        if (!array_key_exists($mimeType, $createFunctions)) {
            throw new InvalidMimeTypeException(sprintf('The "%s" mime type is not supported.', $mimeType));
        }

        $resource = $createFunctions[$mimeType]($path);

        return new static($resource);
    }
646237
public function addMap($class, $path = null)
    {
        if (is_array($class)) {
            foreach ($class as $ns => $path) {
                $this->files->addMap($ns, $path);
            }
        } else {
            $this->files->addMap($class, $path);
        }

        return $this;
    }
1009926
public function setType($type)
    {
        if (strlen($type) == 0) {
            throw new \InvalidArgumentException(sprintf('MIME type should not be empty'));
        }

        if (!preg_match('@^[^/]+/[^/]+$@', $type)) {
            throw new \InvalidArgumentException(sprintf('Invalid MIME type: %s', $type));
        }

        $this->type = $type;

        return $this;
    }
355129
public static function invalidType($value, $class)
    {
        $type = is_object($value) ? get_class($value) : var_export($value);

        return new self("Could not add '{$type}' to collection '{$class}'.");
    }