src/Di/Container.php
public function delete($id)
    {
        if ($this->has($id)) {
            //remove instance
            unset($this->instances[$id]);

            //remove interface reference if exists
            foreach ($this->interfaces as $int => $classes) {
                $key = array_search($id, $classes);
                if ($key !== false) {
                    unset($classes[$key]);
                    $this->interfaces[$int] = $classes;
                }
            }

            //remove instance from singleton binding
            if ($this->hasDefinition($id)) {
                $definition = $this->getDefinition($id);
                if ($definition instanceof Singleton) {
                    $definition->deleteStoredInstance();
                }
            }
        }
        return $this;
    }
public function delete($id)
    {
        if ($this->has($id)) {
            //remove instance
            unset($this->instances[$id]);

            //remove interface reference if exists
            foreach ($this->interfaces as $int => $classes) {
                $key = array_search($id, $classes);
                if ($key !== false) {
                    unset($classes[$key]);
                    $this->interfaces[$int] = $classes;
                }
            }

            //remove instance from singleton binding
            if ($this->hasDefinition($id)) {
                $definition = $this->getDefinition($id);
                if ($definition instanceof Singleton) {
                    $definition->deleteStoredInstance();
                }
            }
        }
        return $this;
    }
public function delete ( $ id ) { if ( $ this -> has ( $ id ) ) { //remove instance unset ( $ this -> instances [ $ id ] ) ; //remove interface reference if exists foreach ( $ this -> interfaces as $ int => $ classes ) { $ key = array_search ( $ id , $ classes ) ; if ( $ key !== false ) { unset ( $ classes [ $ key ] ) ; $ this -> interfaces [ $ int ] = $ classes ; } } //remove instance from singleton binding if ( $ this -> hasDefinition ( $ id ) ) { $ definition = $ this -> getDefinition ( $ id ) ; if ( $ definition instanceof Singleton ) { $ definition -> deleteStoredInstance ( ) ; } } } return $ this ; }
Delete an instance if exists.

@param  string $id
@return Container
Delete an instance if exists .