src/Library/ServiceContainer/ServiceContainer.php
public function unsetService($name)
    {
        if ($this->hasService($name)) {
            if (!$this->isProtected($name)) {
                if ($this->hasProvider($name)) {
                    $data = $this->getProvider($name);
                    if (is_object($data) && CodeHelper::implementsInterface($data, 'Library\ServiceContainer\ServiceProviderInterface')) {
                        $data->terminate($this);
                    }
                }
                $this->_services->offsetUnset($name);
            } else {
                throw new ErrorException(
                    sprintf('Cannot unset protected service "%s"!', $name)
                );
            }
        }
        return $this;
    }
public function unsetService($name)
    {
        if ($this->hasService($name)) {
            if (!$this->isProtected($name)) {
                if ($this->hasProvider($name)) {
                    $data = $this->getProvider($name);
                    if (is_object($data) && CodeHelper::implementsInterface($data, 'Library\ServiceContainer\ServiceProviderInterface')) {
                        $data->terminate($this);
                    }
                }
                $this->_services->offsetUnset($name);
            } else {
                throw new ErrorException(
                    sprintf('Cannot unset protected service "%s"!', $name)
                );
            }
        }
        return $this;
    }
public function unsetService ( $ name ) { if ( $ this -> hasService ( $ name ) ) { if ( ! $ this -> isProtected ( $ name ) ) { if ( $ this -> hasProvider ( $ name ) ) { $ data = $ this -> getProvider ( $ name ) ; if ( is_object ( $ data ) && CodeHelper :: implementsInterface ( $ data , 'Library\ServiceContainer\ServiceProviderInterface' ) ) { $ data -> terminate ( $ this ) ; } } $ this -> _services -> offsetUnset ( $ name ) ; } else { throw new ErrorException ( sprintf ( 'Cannot unset protected service "%s"!' , $ name ) ) ; } } return $ this ; }
Unset a service if it is not protected

@param   string  $name
@return  mixed
@throws  \ErrorException
Unset a service if it is not protected