public function clear()
    {
        foreach (array_keys($this->instances) as $key) {
            $this->instances[$key] = null;
            unset($this->instances[$key]);
        }

        $this->instances = [];
    }