public function remove(string $serviceName) : bool
    {
        if (!$this->has($serviceName)) {
            return false; // can only remove services that exist
        }

        if ($serviceName === 'container') {
            return false; // the container itself cannot be removed
        }

        // remove the already shared instnace if set
        if (isset($this->resolvedSharedServices[$serviceName])) {
            unset($this->resolvedSharedServices[$serviceName]);
        }

        // remove the service type
        if (isset($this->serviceResolverType[$serviceName])) {
            unset($this->serviceResolverType[$serviceName]);
        }

        // remove all possible references
        if (isset($this->serviceProviders[$serviceName])) {
            unset($this->serviceProviders[$serviceName]);
        }
        if (isset($this->resolverMethods[$serviceName])) {
            unset($this->resolverMethods[$serviceName]);
        }
        if (isset($this->resolverFactories[$serviceName])) {
            unset($this->resolverFactories[$serviceName]);
        }

        return true;
    }
public function remove(string $serviceName) : bool
    {
        if (!$this->has($serviceName)) {
            return false; // can only remove services that exist
        }

        if ($serviceName === 'container') {
            return false; // the container itself cannot be removed
        }

        // remove the already shared instnace if set
        if (isset($this->resolvedSharedServices[$serviceName])) {
            unset($this->resolvedSharedServices[$serviceName]);
        }

        // remove the service type
        if (isset($this->serviceResolverType[$serviceName])) {
            unset($this->serviceResolverType[$serviceName]);
        }

        // remove all possible references
        if (isset($this->serviceProviders[$serviceName])) {
            unset($this->serviceProviders[$serviceName]);
        }
        if (isset($this->resolverMethods[$serviceName])) {
            unset($this->resolverMethods[$serviceName]);
        }
        if (isset($this->resolverFactories[$serviceName])) {
            unset($this->resolverFactories[$serviceName]);
        }

        return true;
    }
public function remove ( string $ serviceName ) : bool { if ( ! $ this -> has ( $ serviceName ) ) { return false ; // can only remove services that exist } if ( $ serviceName === 'container' ) { return false ; // the container itself cannot be removed } // remove the already shared instnace if set if ( isset ( $ this -> resolvedSharedServices [ $ serviceName ] ) ) { unset ( $ this -> resolvedSharedServices [ $ serviceName ] ) ; } // remove the service type if ( isset ( $ this -> serviceResolverType [ $ serviceName ] ) ) { unset ( $ this -> serviceResolverType [ $ serviceName ] ) ; } // remove all possible references if ( isset ( $ this -> serviceProviders [ $ serviceName ] ) ) { unset ( $ this -> serviceProviders [ $ serviceName ] ) ; } if ( isset ( $ this -> resolverMethods [ $ serviceName ] ) ) { unset ( $ this -> resolverMethods [ $ serviceName ] ) ; } if ( isset ( $ this -> resolverFactories [ $ serviceName ] ) ) { unset ( $ this -> resolverFactories [ $ serviceName ] ) ; } return true ; }
Removes a service from the container and releases the shared instance
if it has been loaded.

@param string            $serviceName The name / Identifier of the service to look for.

@return bool Returns true if the service has been removed.
Removes a service from the container and releases the shared instance if it has been loaded .