src/ServiceLocator.php
public function set($name, $service)
    {
        if (isset($this->registry[$name])) {
            unset($this->registry[$name]);
        }
        if (isset($this->instances[$name])) {
            unset($this->instances[$name]);
        }
        if (null === $service) {
            return $this;
        }
        if (! is_string($service)) {
            $this->instances[$name] = $service;

            return $this;
        }
        $this->registry[$name] = $service;

        return $this;
    }
public function set($name, $service)
    {
        if (isset($this->registry[$name])) {
            unset($this->registry[$name]);
        }
        if (isset($this->instances[$name])) {
            unset($this->instances[$name]);
        }
        if (null === $service) {
            return $this;
        }
        if (! is_string($service)) {
            $this->instances[$name] = $service;

            return $this;
        }
        $this->registry[$name] = $service;

        return $this;
    }
public function set ( $ name , $ service ) { if ( isset ( $ this -> registry [ $ name ] ) ) { unset ( $ this -> registry [ $ name ] ) ; } if ( isset ( $ this -> instances [ $ name ] ) ) { unset ( $ this -> instances [ $ name ] ) ; } if ( null === $ service ) { return $ this ; } if ( ! is_string ( $ service ) ) { $ this -> instances [ $ name ] = $ service ; return $ this ; } $ this -> registry [ $ name ] = $ service ; return $ this ; }
Sets the service.

@param string $name    The service name
@param mixed  $service The service specification or instance of a
service or null. If the service set as null, it
will be removed.

@return self
Sets the service .