lib/Container.php
public function register($serviceId, \Closure $instantiator, array $tags = [])
    {
        if (isset($this->instantiators[$serviceId])) {
            throw new \InvalidArgumentException(sprintf(
                'Service with ID "%s" has already been registered', $serviceId));
        }

        $this->instantiators[$serviceId] = $instantiator;
        $this->tags[$serviceId] = $tags;
    }
public function register($serviceId, \Closure $instantiator, array $tags = [])
    {
        if (isset($this->instantiators[$serviceId])) {
            throw new \InvalidArgumentException(sprintf(
                'Service with ID "%s" has already been registered', $serviceId));
        }

        $this->instantiators[$serviceId] = $instantiator;
        $this->tags[$serviceId] = $tags;
    }
public function register ( $ serviceId , \ Closure $ instantiator , array $ tags = [ ] ) { if ( isset ( $ this -> instantiators [ $ serviceId ] ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Service with ID "%s" has already been registered' , $ serviceId ) ) ; } $ this -> instantiators [ $ serviceId ] = $ instantiator ; $ this -> tags [ $ serviceId ] = $ tags ; }
Register a service with the given ID and instantiator.

The instantiator is a closure which accepts an instance of this container and
returns a new instance of the service class.

@param string $serviceId
@param \Closure $instantiator
@param string[][] $tags
Register a service with the given ID and instantiator .