Validate the plugin

Checks that the Service is an instance of ServiceInterface

@param  mixed $service
@throws InvalidPluginException
@return void
437858
public function validatePlugin($service)
    {
        if ($service instanceof ServiceInterface) {
            return;
        }

        throw new InvalidPluginException(sprintf(
            'Plugin of type %s is invalid; must implement %s\Service\ServiceInterface',
            (is_object($service) ? get_class($service) : gettype($service)),
            __NAMESPACE__
        ));
    }
990072
public function setServices(array $services = null)
    {
        ValidationUtility::ensureNullOrArrayOfType(
            '$services', $services, __NAMESPACE__ . '\Service');

        $this->services = $services;

        return $this;
    }
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__
        ));
    }
774043
public function registerService($service, $name = '') {
        if (empty($name)) {
            $name = Assist::classNameShort($service);
        }

        static::$container->offsetSet(strtolower($name), $service);
    }
769435
public function validateProviders(array $providers) : void
    {
        Assert::allClassExists($providers);
        Assert::allImplementsInterface($providers, self::PROVIDER_INTERFACE);

        foreach ($this->requiredProviders as $name) {
            if (!in_array($name, array_keys($providers))) {
                throw new InvalidArgumentException("Configuration is missing a required provider for [$name]");
            }
        }
    }
1000230
protected function validateMethod($method)
    {
        $valid = [
            'GET'     => true,
            'POST'    => true,
            'DELETE'  => true,
            'PUT'     => true,
            'PATCH'   => true,
            'HEAD'    => true,
            'OPTIONS' => true,
        ];

        if (!isset($valid[$method])) {
            throw new InvalidArgumentException(
                'Invalid method version. Must be one of: GET, POST, DELETE, PUT, PATCH, HEAD or OPTIONS'
            );
        }
    }
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
        ));
    }
448417
public function register(ContainerInterface $container, Configurable $config)
    {
        if ( ! $config instanceof Config) {
            throw new \InvalidArgumentException('Wrong Config object');
        }
        
        $validator = Validation::createValidatorBuilder();

        if ($config->annotationMapping) {
            $validator->enableAnnotationMapping();
        }

        $container->add($config->getServiceName(), $validator->getValidator());
    }
696538
public function validatePlugin($plugin)
    {
        try {
            $this->validate($plugin);
        } catch (InvalidServiceException $e) {
            throw new RuntimeException($e->getMessage(), $e->getCode(), $e);
        }
    }
1099802
protected function validateInput(InputInterface $input)
    {
        $options = ['tags', 'tag', 'parameters', 'parameter'];

        $optionsCount = 0;
        foreach ($options as $option) {
            if ($input->getOption($option)) {
                ++$optionsCount;
            }
        }

        $name = $input->getArgument('name');
        if ((null !== $name) && ($optionsCount > 0)) {
            throw new InvalidArgumentException('The options tags, tag, parameters & parameter can not be combined with the service name argument.');
        } elseif ((null === $name) && $optionsCount > 1) {
            throw new InvalidArgumentException('The options tags, tag, parameters & parameter can not be combined together.');
        }
    }
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
            ));
        }
    }
1284041
function validateService($pluginInstance)
    {
        if (!is_callable($pluginInstance))
            throw new exContainerInvalidServiceType(sprintf(
                'Plugin must be callable; given:(%s).'
                , \Poirot\Std\flatten($pluginInstance)
            ));
    }
1127867
protected function validateMethod($method)
    {
        if (null === $method) {
            return;
        }

        if (!is_string($method)) {
            throw new InvalidArgumentException('HTTP method must be a string.');
        }

        if (!preg_match('/^[!#$%&\'*+.^_`\|~0-9a-z-]+$/i', $method)) {
            throw new InvalidArgumentException(sprintf('Invalid HTTP method "%s"', $method));
        }
    }
864404
public void registerService(Object service)
    {
    	this.setService(service);
    	String serviceClass = getInterfaceClassName(); 

    	if (service != null)
    		serviceRegistration = context.registerService(serviceClass, this.service, properties);
    }
586448
public function setService($name, $service)
    {
        $this->validate($service);
        parent::setService($name, $service);
    }
751138
protected function validateFactoryEntry($entry)
    {
        if (!is_string($entry) && !is_callable($entry) && !$entry instanceof FactoryInterface) {
            $type = is_object($entry) ? get_class($entry) : gettype($entry);
            $message = sprintf('Argument "entry" in "%s" must be a string, a callable or an instance '
                    . 'of "%s"; "%s" was given.', __METHOD__, FactoryInterface::class, $type);
            throw new Exception\InvalidArgumentException($message);
        }

        if (is_string($entry)) {
            if (!class_exists($entry)) {
                throw new Exception\ClassNotFoundException($entry);
            }

            if (!is_subclass_of($entry, FactoryInterface::class)) {
                $message = sprintf('Entry "%s" in "%s" is expected to be an instance of "%s".', $entry, __METHOD__, FactoryInterface::class);
                throw new Exception\InvalidArgumentException($message);
            }
        }
    }
1112992
public function setService($service)
    {
        $prefix = $this->getConfig('service_class_prefix');

        $this->service[$service] = $this->createInstance($service, $prefix, [$this->client]);
    }