@param Plugin $plugin

@return HttpClientConfigurator
425837
public function appendPlugin(Plugin ...$plugin): self
    {
        foreach ($plugin as $p) {
            $this->appendPlugins[] = $p;
        }

        return $this;
    }
401682
public function plugin($plugin, array $pluginConfig = [], $init = true)
        {
            // Module plugin
            //   ex: 'Module\User'
            if (false !== strpos($plugin, 'Module\\')) {
                $sPluginClass = $plugin . '\Plugin';

            // Named plugin
            //   ex: 'Spot'
            } else {
                // Upper-case beginning of each word
                $sPlugin = str_replace(' ', '\\', ucwords(str_replace('_', ' ', $plugin)));
                $sPluginClass = 'Plugin\\' . $sPlugin . '\Plugin';
            }

            // Ensure class exists / can be loaded
            if (!class_exists($sPluginClass, (boolean) $init)) {
                if ($init) {
                    throw new \InvalidArgumentException("Unable to load plugin '" . $sPluginClass . "'. Remove from app configuration file or ensure plugin files exist in 'app' or 'Thin' load paths.");
                }

                return false;
            }

            // Instantiate plugin class with params
            return $this->factory($sPluginClass, [$this, $pluginConfig]);
        }
903195
public function appendPlugin(Plugin ...$plugins)
    {
        foreach ($plugins as $plugin) {
            $this->appendPlugins[] = $plugin;
        }

        return $this;
    }
864833
private function updateWidget($widgetConfiguration, Plugin $plugin)
    {
        /** @var Widget $widget */
        $widget = $this->em
            ->getRepository('ClarolineCoreBundle:Widget\Widget')
            ->findOneBy(['name' => $widgetConfiguration['name']]);

        if (is_null($widget)) {
            return $this->createWidget($widgetConfiguration, $plugin);
        } else {
            return $this->persistWidget($widgetConfiguration, $widget);
        }
    }
7288
public function validatePlugin($plugin)
    {
        if ($plugin instanceof DispatchableInterface) {
            // we're okay
            return;
        }

        throw new Exception\InvalidControllerException(sprintf(
            'Controller of type %s is invalid; must implement Zend\Stdlib\DispatchableInterface',
            (is_object($plugin) ? get_class($plugin) : gettype($plugin))
        ));
    }
719897
protected function disablePlugin(PluginDescription $plugin)
    {
        $notify = false;
        $plugin->setIsEnabled(false);
        $pluginService = $this->container->get($plugin->getPluginId());

        foreach ($plugin->getDataProviders() as $provider) {
            $dataProviders = explode("|", $provider);
            foreach ($dataProviders as $dataProvider) {
                $this->dataProviderManager->deletePlugin($dataProvider, $plugin->getPluginId());
            }
        }

        if (isset($this->enabledPlugins[$plugin->getPluginId()])) {
            unset($this->enabledPlugins[$plugin->getPluginId()]);

            $notify = true;
        }

        return $notify ? $pluginService : null;
    }
276745
public function validatePlugin($plugin)
    {
        if ($plugin instanceof DomainServiceInterface) {
            return; // we're okay
        }

        throw new \InvalidArgumentException(sprintf(
            'Can\'t create domain service for %s; '
                . 'Domain service must implement %s',
            (is_object($plugin) ? get_class($plugin) : gettype($plugin)),
            DomainServiceInterface::class
        ));
    }
638045
public function addPlugin(PluginInterface $plugin)
    {
        $plugin->onAdd($this); // Called before adding the plugin, because it may throw an exception
        $this->plugins[] = $plugin;
        
        return $this;
    }
696538
public function validatePlugin($plugin)
    {
        try {
            $this->validate($plugin);
        } catch (InvalidServiceException $e) {
            throw new RuntimeException($e->getMessage(), $e->getCode(), $e);
        }
    }
726722
public function getRequiredBy($plugin)
    {
        $requiredBy = [];
        $plugin = $this->getBundle($plugin);

        foreach ($this->getInstalledBundles() as $bundle) {
            $requirements = $bundle['instance']->getRequiredPlugins();
            if (in_array(get_class($plugin), $requirements)) {
                $requiredBy[] = get_class($bundle['instance']);
            }
        }

        return $requiredBy;
    }
405909
public function attachPlugin($name, Plugin $plugin)
    {
        $plugin->register($this);
        $this->plugins[$name] = $plugin;
        return $this;
    }
1102010
public function getPluginOption($plugin, $option = null)
    {
        $option = $option ? '.'.$option : '';

        return $this->config->get('plugins.config.'.$plugin.$option);
    }
663731
public function validatePlugin($plugin)
    {
        //bug fix: not all plugin implements the ViewHelperInterface
        //eg: PaginationControl, but it has the setView method so it's ok to inject
        if ($plugin instanceof ViewHelperInterface || method_exists($plugin, 'setView')) {
            // we're okay
            return;
        }

        throw new Exception\RuntimeException(sprintf(
            'Plugin of type %s is invalid; must implement Zend_View_Helper_Interface',
            (is_object($plugin) ? get_class($plugin) : gettype($plugin))
        ));
    }
1160359
public function validatePlugin($plugin)
    {
        if ($this->isValidModuleOptions($plugin)) {
            return;
        }

        throw new Exception\RuntimeException(sprintf(
            'Plugin of type %s is invalid; must implement %s',
            (is_object($plugin) ? get_class($plugin) : gettype($plugin)),
            ModuleOptionsInterface::class
        ));
    }
388386
public static function getPlugin($plugin) {
        return self::cache(array(__METHOD__, $plugin), function() use ($plugin) {
            $path = null;

            if ($plugin !== Configure::read('Admin.coreName')) {
                if (!CakePlugin::loaded($plugin)) {
                    return null;
                }

                $path = CakePlugin::path($plugin);
            }

            return array(
                'title' => $plugin,
                'path' => $path,
                'slug' => Inflector::underscore($plugin),
                'models' => Admin::getPluginModels($plugin)
            );
        });
    }
124113
public function add($plugin)
	{
		if (is_array($plugin))
		{
			$this->plugins = array_merge($this->plugins, $plugin);
		}
		else
		{
			$this->plugins[] = $plugin;
		}
		
		return $this;
	}
653795
public function searchAction($plugin, Request $request)
    {
        $response = $this->getCacheTimeKeeper()->getResponse();
        // response was not modified for this request
        if ($response->isNotModified($request)) {
            return $response;
        }

        /* @var $search SearchInterface */
        if (!($search = $this->get('anime_db.plugin.search_fill')->getPlugin($plugin))) {
            throw $this->createNotFoundException('Plugin \''.$plugin.'\' is not found');
        }

        /* @var $form Form */
        $form = $this->createForm($search->getForm());

        $list = [];
        $form->handleRequest($request);
        if ($form->isValid()) {
            $list = $search->search($form->getData());
        }

        // full page or hinclude
        if ($request->get('hinclude', 0)) {
            $tpl = 'AnimeDbCatalogBundle:Fill:search_hinclude.html.twig';
        } else {
            $tpl = 'AnimeDbCatalogBundle:Fill:search.html.twig';
        }

        return $this->render($tpl, [
            'plugin' => $plugin,
            'plugin_name' => $search->getTitle(),
            'list' => $list,
            'form' => $form->createView(),
        ], $response);
    }