Validate the plugin

Ensure we have a dispatchable.

@param  mixed $plugin
@return true
@throws Exception\InvalidControllerException
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))
        ));
    }
673891
public function check(PluginBundleInterface $plugin, $updateMode = false)
    {
        $this->plugin = $plugin;
        $this->pluginFqcn = get_class($plugin);
        $this->errors = [];
        $this->checkRoutingPrefixIsValid();
        count($this->errors) === 0 && $this->checkRoutingPrefixIsNotAlreadyRegistered();
        $this->checkRoutingResourcesAreLoadable();

        return $this->errors;
    }
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);
        }
    }
695113
protected function validate($params)
    {
        if (array_get($params, 'data.dispatchable') === false) {
            return false;
        }
        if (is_null($classname = array_get($params, 'data.classname'))) {
            return false;
        }
        try {
            if (!class_exists($classname)) {
                return false;
            }
        } catch (Exception $ex) {
            return false;
        }

        return $classname;
    }
1308215
public function validate ($object = null)
	{
		if (!isset ($this->context))
		{
			throw new InvalidParameter ("You must set a context before validating or filtering.");
		}

		$result = $this->reduce ($this->context, $object);

		if ($result)
		{
			return true;
		}
		else
		{
			return false;
		}
	}
87940
public function main($plugin = null)
    {
        $filename = 'bootstrap';
        if ($this->params['cli']) {
            $filename .= '_cli';
        }

        $this->bootstrap = ROOT . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . $filename . '.php';

        if (!$plugin) {
            $this->err('You must provide a plugin name in CamelCase format.');
            $this->err('To load an "Example" plugin, run `cake plugin load Example`.');

            return false;
        }

        $options = $this->makeOptions();

        $app = APP . 'Application.php';
        if (file_exists($app) && !$this->param('no_app')) {
            $this->modifyApplication($app, $plugin, $options);

            return true;
        }

        return $this->_modifyBootstrap($plugin, $options);
    }
1356097
protected function _enable(PluginPackage $plugin)
    {
        $checker = new RuleChecker((array)$plugin->composer['require']);
        if (!$checker->check()) {
            $this->err(__d('installer', 'Plugin "{0}" cannot be enabled as some dependencies are disabled or not installed: {1}', $plugin->humanName, $checker->fail(true)));

            return false;
        }

        // MENTAL NOTE: As plugin is disabled its listeners are not attached to the
        // system, so we need to manually attach them in order to trigger callbacks.
        if (!$this->params['no-callbacks']) {
            $this->_attachListeners($plugin->name, "{$plugin->path}/");
            $trigger = $this->_triggerBeforeEvents($plugin);
            if (!$trigger) {
                return false;
            }
        }

        return $this->_finish($plugin);
    }
8995
def valid_command_plugin(self, plugin):
        
        if (issubclass(plugin, CommandPlugin)   and
            hasattr(plugin, 'plugin_type')      and plugin.plugin_type == 'command' and
            hasattr(plugin, 'name')             and plugin.name != None):
            return True
        return False
968222
public function validatePlugin($plugin)
    {
        if ($plugin instanceof WidgetInterface)
            return true;

        throw new \Exception(sprintf(
            'yimaWidgetator of type %s is invalid; must implement yimaWidgetator\Widget\WidgetInterface',
            (is_object($plugin) ? get_class($plugin) : gettype($plugin))
        ));
    }
398594
public function validatePlugin($plugin)
    {
        if (!$plugin instanceof ModelInterface) {
            throw new Exception\InvalidPluginException(sprintf(
                'Model of type %s is invalid; must implement "%s"',
                (is_object($plugin) ? get_class($plugin) : gettype($plugin)),
                ModelInterface::class
            ));
        }
    }
852704
public function validatePlugin($plugin)
    {
        if ($plugin instanceof MapperInterface) {
            return; // we're okay
        }

        throw new \InvalidArgumentException(sprintf(
            'Can\'t create mapper for %s; Mapper must implement %s',
            (is_object($plugin) ? get_class($plugin) : gettype($plugin)),
            MapperInterface::class
        ));
    }
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
        ));
    }
595283
public function validate(Control $control): bool
  {
    return ($this->data===null) ? ($this->callable)($control) : ($this->callable)($control, $this->data);
  }
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
        ));
    }
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()));
        }
    }
1015858
public function isSaved(PluginBundle $plugin)
    {
        if ($this->getPluginByFqcn(get_class($plugin)) !== null) {
            return true;
        }

        return false;
    }
866733
public function validatePlugin($plugin)
    {
        if($plugin instanceof AdapterInterface) {
            return;
        }

        throw new InvalidPluginException(sprintf(
            'Plugin of type %s is invalid; must implement %s\AdapterInterface and set ID',
            (is_object($plugin) ? get_class($plugin) : gettype($plugin)),
            __NAMESPACE__
        ));
    }