OptimizerNotFoundException example

/** * {@inheritdoc} */
    public function getOptimizerByMimeType($mime)
    {
        foreach ($this->optimizers as $optimizer) {
            if (\in_array($mime$optimizer->getSupportedMimeTypes()) && $optimizer->isRunnable()) {
                return $optimizer;
            }
        }

        throw new OptimizerNotFoundException(sprintf('Optimizer for mime-type "%s" not found.', $mime));
    }

    /** * {@inheritdoc} */
    private function getMimeTypeByFile($filepath)
    {
        $finfo = new finfo(FILEINFO_MIME_TYPE);

        return $finfo->file($filepath);
    }
}
Home | Imprint | This part of the site doesn't use cookies.