core/Field.php
public static function getInstance(string $type)
    {
        if (empty($type)) {
            return null;
        }
        if (isset(self::$instance[$type])) {
            return self::$instance[$type];
        }
        $class = '\\beacon\\widget\\' . Utils::toCamel($type);
        //  Logger::log($class);
        if (!class_exists($class)) {
            return null;
        }
        $reflect = new \ReflectionClass($class);
        if (!$reflect->implementsInterface(WidgetInterface::class)) {
            return null;
        }
        self::$instance[$type] = new $class();
        return self::$instance[$type];
    }
public static function getInstance(string $type)
    {
        if (empty($type)) {
            return null;
        }
        if (isset(self::$instance[$type])) {
            return self::$instance[$type];
        }
        $class = '\\beacon\\widget\\' . Utils::toCamel($type);
        //  Logger::log($class);
        if (!class_exists($class)) {
            return null;
        }
        $reflect = new \ReflectionClass($class);
        if (!$reflect->implementsInterface(WidgetInterface::class)) {
            return null;
        }
        self::$instance[$type] = new $class();
        return self::$instance[$type];
    }
获取插件实例
@param string $type
@return WidgetInterface
@throws \ReflectionException