public static function detectAvailableEditor($editorList = null)
{
if (null === $editorList) {
$editorList = self::$editorList;
}
/* Get first supported editor instance. Order of editorList matter. */
foreach ($editorList as $editorName) {
if ('Imagick' === $editorName) {
$editorInstance = new ImagickEditor();
} else {
$editorInstance = new GdEditor();
}
/** @var EditorInterface $editorInstance */
if (true === $editorInstance->isAvailable()) {
return $editorName;
}
}
throw new \Exception('No supported editor.');
}