Zend\Mvc\Service\ServiceListenerFactory::validatePluginManagerOptions PHP Method

validatePluginManagerOptions() private method

Ensures all required keys are present in the expected types.
private validatePluginManagerOptions ( array $options, string $name )
$options array
$name string Plugin manager service name; used for exception messages
    private function validatePluginManagerOptions($options, $name)
    {
        if (!is_array($options)) {
            throw new ServiceNotCreatedException(sprintf('Plugin manager configuration for "%s" is invalid; must be an array, received "%s"', $name, is_object($options) ? get_class($options) : gettype($options)));
        }
        if (!isset($options['service_manager'])) {
            throw new ServiceNotCreatedException(sprintf(self::MISSING_KEY_ERROR, $name, 'service_manager'));
        }
        if (!is_string($options['service_manager'])) {
            throw new ServiceNotCreatedException(sprintf(self::VALUE_TYPE_ERROR, 'service_manager', gettype($options['service_manager'])));
        }
        if (!isset($options['config_key'])) {
            throw new ServiceNotCreatedException(sprintf(self::MISSING_KEY_ERROR, $name, 'config_key'));
        }
        if (!is_string($options['config_key'])) {
            throw new ServiceNotCreatedException(sprintf(self::VALUE_TYPE_ERROR, 'config_key', gettype($options['config_key'])));
        }
        if (!isset($options['interface'])) {
            throw new ServiceNotCreatedException(sprintf(self::MISSING_KEY_ERROR, $name, 'interface'));
        }
        if (!is_string($options['interface'])) {
            throw new ServiceNotCreatedException(sprintf(self::VALUE_TYPE_ERROR, 'interface', gettype($options['interface'])));
        }
        if (!isset($options['method'])) {
            throw new ServiceNotCreatedException(sprintf(self::MISSING_KEY_ERROR, $name, 'method'));
        }
        if (!is_string($options['method'])) {
            throw new ServiceNotCreatedException(sprintf(self::VALUE_TYPE_ERROR, 'method', gettype($options['method'])));
        }
    }