public function uninstall($id)
    {
        $plugin = $this->getById($id);
        if (!$plugin) {
            return ['code' => -3, 'message' => 'Plugin not found'];
        }

        if (!$this->isInstalled($id)) {
            return ['code' => -4, 'message' => 'Plugin not installed'];
        }

        if ($this->isBuildIn($id)) {
            return ['code' => -5, 'message' => 'Can not uninstall build-in plugin'];
        }

        $ret = $plugin->uninstall();
        if ($ret['code'] !== 1) {
            return $ret;
        }

        $pluginIds = $this->getInstalledIds();
        $key = array_search($id, $pluginIds);
        if (false === $key) {
            return ['code' => -6, 'message' => 'Plugin not installed'];
        }
        unset($pluginIds[$key]);
        $this->setInstalledIds($pluginIds);

        $this->getEvents(true);

        return $ret;
    }