Validate the plugin

Checks that the filter loaded is either a valid callback or an instance
of FilterInterface.

@param  mixed $plugin
@return void
@throws Exception\RuntimeException if invalid
438782
public function validatePlugin($plugin)
    {
        if ($plugin instanceof UiAdapter\UiAdapterInterface) {
            // we're okay
            return;
        }

        throw new Exception\InvalidArgumentException(sprintf(
            'Plugin of type %s is invalid; must extend %s\UiAdapter\UiAdapterInterface',
            (is_object($plugin) ? get_class($plugin) : gettype($plugin)),
            __NAMESPACE__
        ));
    }
225345
public function validate($value)
    {
        try {
            $this->_validate($value);
        } catch (RootException $e) {
            if ($e instanceof ValidationFailedExceptionInterface) {
                throw $e;
            }

            $this->_throwValidationException($this->__('Problem validating'), null, $e, true);
        }
    }
564161
public function registerPlugin(Plugin $plugin)
    {
        try {
            $this->smarty->registerPlugin($plugin->getType(), $plugin->getName(), $plugin->getCallbackFunction(),
                $plugin->getAttribute('Cachable', true), $plugin->getAttribute('CacheAttr', null));
        } catch (\SmartyException $e) {
            throw new SmartyException($e);
        }
    }
1106705
private function validateShippedDependencies(
        PluginEntity $plugin,
        array $pluginRequirements,
        RequirementExceptionStack $exceptionStack
    ): array {
        if ($plugin->getManagedByComposer()) {
            return $pluginRequirements;
        }

        $vendorDir = $this->pluginComposer->getConfig()->get('vendor-dir');
        if (!is_dir($vendorDir)) {
            return $pluginRequirements;
        }

        $pluginRequirements = $this->checkComposerDependencies(
            $pluginRequirements,
            $exceptionStack,
            $this->pluginComposer
        );

        return $pluginRequirements;
    }
66233
protected function validatePlugins(): void
    {
        $plugins = array_filter($this->getActivePlugins(), function ($plugin) {
            return file_exists(WPMU_PLUGIN_DIR.'/'.$plugin);
        });

        if (array_diff($plugins, $this->getActivePlugins())) {
            $this->setActivePlugins($plugins);
        }
    }
878194
public function plugin($plugin)
    {
        $this->out('<info>Compiling one ' . $plugin . '\'s templates</info>');
        $this->walkIterator(Scanner::plugin($plugin));
    }
218417
private function validate($method)
    {
        $actionMethod = $method.'Method';
        $ref = new \ReflectionClass($this->manager);

        if (null === $this->$actionMethod || !$ref->hasMethod($this->$actionMethod)) {
            throw new \RuntimeException(sprintf('The "%s" method for "%s" adapter is does not supported', $method, $this->getClass()));
        }
    }
632388
public function validate(PluginBundleInterface $plugin)
    {
        $validationErrors = [];

        foreach ($this->checkers as $checker) {
            if (null !== $errors = $checker->check($plugin, $this->isInUpdateMode())) {
                $validationErrors = array_merge($validationErrors, $errors);
                continue;
            }

            if ($checker instanceof ConfigurationChecker) {
                $this->pluginConfiguration = $checker->getProcessedConfiguration();
            }
        }

        return $validationErrors;
    }
127313
protected static function _checkData($plugin)
    {
        return (Arr::in($plugin, self::$_data)) ? self::$_data[$plugin] : [];
    }
52972
public function validatePlugin($plugin)
    {
        if ($plugin instanceof AbstractContainer) {
            return; // we're okay
        }

        throw new \InvalidArgumentException(sprintf(
            'Can\'t create session container for %s; Session conatiner must implement %s',
            (is_object($plugin) ? get_class($plugin) : gettype($plugin)),
            AbstractContainer::class
        ));
    }
710686
private function validatePlugins()
    {
        foreach (self::$cache['plugins'] as $plugin_file => $plugin_info) {
            if (!file_exists(WPMU_PLUGIN_DIR . '/' . $plugin_file)) {
                $this->updateCache();
                break;
            }
        }
    }
1042152
public static function static_function($plugin, $function) {
        global $CFG;

        //check that the plugin exists
        $typedirectory = $CFG->dirroot . '/repository/'. $plugin . '/lib.php';
        if (!file_exists($typedirectory)) {
            //throw new repository_exception('invalidplugin', 'repository');
            return false;
        }

        $args = func_get_args();
        if (count($args) <= 2) {
            $args = array();
        } else {
            array_shift($args);
            array_shift($args);
        }

        require_once($typedirectory);
        return call_user_func_array(array('repository_' . $plugin, $function), $args);
    }
293572
function validateService($pluginInstance)
    {
        if (! is_object($pluginInstance) )
            throw new \Exception(sprintf('Can`t resolve to (%s) Instance.', $pluginInstance));

        if (!$pluginInstance instanceof aGrantRequest)
            throw new exContainerInvalidServiceType('Invalid Plugin Of Content Object Provided.');
    }
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
        ));
    }
1342689
protected function loadPlugin($plugin)
    {
        $pluginName = get_class($plugin);

        $apiVersion = self::API_VERSION_0_9;
        if ($plugin instanceof PicoPluginInterface) {
            if (defined($pluginName . '::API_VERSION')) {
                $apiVersion = $pluginName::API_VERSION;
            } else {
                $apiVersion = self::API_VERSION_1_0;
            }
        }

        if (!isset($this->plugins[$apiVersion][$pluginName])) {
            // PicoDeprecated currently supports all previous API versions
            $this->plugins[$apiVersion][$pluginName] = $plugin;
        }
    }
885401
public function validatePlugin($plugin)
    {
        if ($plugin instanceof AchievementProviderInterface) {
            return; // we're okay
        }

        throw new RuntimeException(
            sprintf(
                'Plugin of type %s is invalid; must implement ' .
                'AxalianAchievements\AchievementProvider\AchievementProviderInterface',
                (is_object($plugin) ? get_class($plugin) : gettype($plugin))
            )
        );
    }
212211
public function validatePlugin($plugin)
    {
        if ($plugin instanceof AbstractPlugin) {
            return; // we're okay
        }

        throw new \InvalidArgumentException(sprintf(
            'Can\'t create jQuery plugin for %s; Plugin must be an instance of %s',
            (is_object($plugin) ? get_class($plugin) : gettype($plugin)),
            AbstractPlugin::class
        ));
    }