src/Application.php
public function addProvider($providerName, $consumer)
    {
        if (!class_exists($consumer) && !interface_exists($consumer)) {
            throw new InvalidArgumentException(
                'Consumer "'.$consumer.'" doesn\'t exist for provider "'.$providerName.'"'
            );
        }

        if (isset($this->providers[$providerName])) {
            throw new DuplicateProviderException($providerName);
        }

        $this->providers[$providerName] = ['consumer' => $consumer, 'scope' => 'global'];

        DomainEvents::dispatch(new AddedProviderEvent($providerName, $consumer));
    }
public function addProvider($providerName, $consumer)
    {
        if (!class_exists($consumer) && !interface_exists($consumer)) {
            throw new InvalidArgumentException(
                'Consumer "'.$consumer.'" doesn\'t exist for provider "'.$providerName.'"'
            );
        }

        if (isset($this->providers[$providerName])) {
            throw new DuplicateProviderException($providerName);
        }

        $this->providers[$providerName] = ['consumer' => $consumer, 'scope' => 'global'];

        DomainEvents::dispatch(new AddedProviderEvent($providerName, $consumer));
    }
public function addProvider ( $ providerName , $ consumer ) { if ( ! class_exists ( $ consumer ) && ! interface_exists ( $ consumer ) ) { throw new InvalidArgumentException ( 'Consumer "' . $ consumer . '" doesn\'t exist for provider "' . $ providerName . '"' ) ; } if ( isset ( $ this -> providers [ $ providerName ] ) ) { throw new DuplicateProviderException ( $ providerName ) ; } $ this -> providers [ $ providerName ] = [ 'consumer' => $ consumer , 'scope' => 'global' ] ; DomainEvents :: dispatch ( new AddedProviderEvent ( $ providerName , $ consumer ) ) ; }
Add global providers

@param string $providerName The provider name
@param string $consumer The consumer of the provider
@return self
@throws \InvalidArgumentException If $consumer class doesn't exist
@throws DuplicateProviderException If $providerName already exists
Add global providers