@param array|Traversable $providers

@throws InvalidArgumentException
514172
public function setProviders($providers)
    {
        $this->guardForArrayOrTraversable($providers);

        foreach ($providers as $provider) {
            $this->addProvider($provider);
        }
    }
133021
protected function addProviders($providers)
    {
        foreach ($providers as $provider) {
            $this->output->writeln('<info>Adding '.$provider.' to Laravel config app.php file</info>');
            $this->addProvider($provider);
        }
    }
843830
public function middleware(...$middlewares): void
    {
        foreach ($middlewares as $middleware) {
            if (!$middleware instanceof MiddlewareInterface && !\is_string($middleware)) {
                $type = \is_object($middleware) ? \get_class($middleware) : \gettype($middleware);
                
                throw new \InvalidArgumentException(\sprintf('Unsupported middleware type: %s', $type));
            }
            
            $this->middlewares[] = $middleware;
        }
    }
996370
private function getProvider($providerServiceKey)
    {
        try {
            $provider = $this->getContainer()->get($providerServiceKey);
        } catch (ServiceNotFoundException $e) {
            throw new \InvalidArgumentException(sprintf('Provider "%s" should be defined as a service.', $providerServiceKey), $e->getCode(), $e);
        }
        if (!$provider instanceof ProviderInterface) {
            throw new \InvalidArgumentException(sprintf('Provider "%s" should implement Mailjet\MailjetBundle\Provider\ProviderInterface.', $providerServiceKey));
        }
        return $provider;
    }
916633
protected function assertIterable($subject, $msg): void
    {
        $iterable = function_exists('is_iterable')
            ? is_iterable($subject)
            : is_array($subject) || $subject instanceof Traversable;
        
        if (!$iterable) {
            throw new InvalidArgumentException($msg);
        }
    }
591054
public function addProvider($name, ReindexProviderInterface $provider)
    {
        if (isset($this->providers[$name])) {
            throw new \InvalidArgumentException(sprintf(
                'Reindex provider with name "%s" has already been registered.',
                $name
            ));
        }

        $this->providers[$name] = $provider;
    }
809927
public static function pathsToPublish($provider = null, $group = null)
    {
        if (! is_null($paths = static::pathsForProviderOrGroup($provider, $group))) {
            return $paths;
        }

        return collect(static::$publishes)->reduce(function ($paths, $p) {
            return array_merge($paths, $p);
        }, []);
    }
378694
private function setupLaravelConfigFile($providers, $aliases)
    {
        if ($this->installConfigFile() == -1) {
            return -1;
        }

        $this->addProviders($providers);

        $this->addAliases($aliases);
    }
789718
public function addProvider(ProviderInterface $provider)
    {
        if (array_key_exists($name = $provider->getName(), $this->providers)) {
            throw new \InvalidArgumentException("Wide search provider '{$name}' is already registered.");
        }

        $this->providers[$name] = $provider;
    }
716261
protected function loadResource($resources, $parent = null)
    {
        if (!is_array($resources) && !($resources instanceof \Traversable)) {
            throw new \InvalidArgumentException('Resources argument must be traversable: ' . print_r($resources, true));
        }

        foreach ($resources as $key => $value) {
            if ($value instanceof ResourceInterface) {
                $key = $value;
            } elseif (is_string($key)) {
                $key = new GenericResource($key);
            } elseif (is_int($key)) {
                $key = new GenericResource($value);
            }

            if (is_array($value) || ($value instanceof \Traversable)) {
                $this->acl->addResource($key, $parent);
                $this->loadResource($value, $key);
            } elseif (!$this->acl->hasResource($key)) {
                $this->acl->addResource($key, $parent);
            }
        }
    }
182931
protected static function apiCall($provider, $method, $uri, $params = [])
    {
        $methodName = $method . 'ApiCall';
        if (method_exists($provider, $methodName)) {
            return $provider->{$methodName}($uri, $params);
        }
        throw new InvalidRequestException();
    }
680092
protected function init($options)
    {
        if ($options instanceof Traversable) {
            $options = ArrayUtils::iteratorToArray($options);
        } elseif (!is_array($options)) {
            $errMsg = sprintf('%s  expects an array or Traversable config', __METHOD__);
            throw new Exception\InvalidArgumentException($errMsg);
        }

        if (!array_key_exists('serviceLocator', $options)) {
            $errMsg = 'Argument serviceLocator not found';
            throw new Exception\InvalidArgumentException($errMsg);
        }
        $this->setServiceLocator($options['serviceLocator']);

        if (!array_key_exists('moduleOptions', $options)) {
            $errMsg = 'Argument moduleOptions not found';
            throw new Exception\InvalidArgumentException($errMsg);
        }
        $this->setModuleOptions($options['moduleOptions']);
    }
1066239
public function append($items)
    {
        if (!is_array($items) && !$items instanceof Traversable) {
            throw new InvalidArgumentException("Argument must be an array or instance of Traversable");
        }

        foreach ($items as $key => $value) {
            $this->set($key, $value);
        }

        return $this;
    }
631672
public function setProvider( $provider )
	{
		if ( $provider == $this->getProvider() ) { return; }

		$this->_values['provider'] = (string) $provider;
		$this->setModified();
	}
143925
public function addProvider($provider)
    {
        $this->providers[] = $provider;
        $this->providers = array_unique($this->providers, SORT_REGULAR);
        $this->logDebug('Added provider: ' . get_class($provider));
    }
150156
public function addAbbreviations($values)
    {
        if (is_array($values)) {
            $values = new ArrayProvider($values);
        } elseif (!($values instanceof ValueProvider)) {
            throw new InvalidArgumentException('Values argument must either be an array or an instance of '.ValueProvider::class);
        }

        $this->abbreviationProviders[] = $values;
    }
649444
public function setProvider($class, $provider)
    {

        ltrim($class, '\\');

        if ($provider instanceof Provider) {
            $this->providers[$class] = $provider;
            return $this;
        }

        if (is_callable($provider)) {
            $this->providerFactories[$class] = $provider;
            return $this;
        }

        if (!is_string($provider)) {
            throw new InvalidArgumentException("Provider has to be callable, Provider or a class name.");
        }

        $this->providerFactories[$class] = function () use ($provider) {
            return $this->createObject($provider);
        };

        return $this;
    }