public function clean($params = [])
    {
        if ( ! empty($this->config['primary_config_file']))
        {
            $default_settings = Arr::dot(Config::get($this->config['primary_config_file']));
            $saved_settings   = Arr::dot($this->getAll($cache = false));

            if (array_key_exists('flush', $params) && $params['flush'] == true)
            {
                $this->flush();

                $saved_settings = [];
            }
            else
            {
                foreach ($saved_settings as $key => $value)
                {
                    if ( ! array_key_exists($key, $default_settings))
                    {
                        if ( ! key_represents_an_array($key, $default_settings))
                        {
                            $this->forget($key);
                        }
                    }
                }
            }


            // update with new settings
            foreach ($default_settings as $key => $value)
            {
                if ( ! preg_key_exists($key, $saved_settings))
                {
                    // check if key does not represents an array and exists in saved settings
                    if ( ! key_represents_an_array($key, $saved_settings))
                    {
                        $this->set($key, $value);
                    }
                }
            }
        }
    }
public function clean($params = [])
    {
        if ( ! empty($this->config['primary_config_file']))
        {
            $default_settings = Arr::dot(Config::get($this->config['primary_config_file']));
            $saved_settings   = Arr::dot($this->getAll($cache = false));

            if (array_key_exists('flush', $params) && $params['flush'] == true)
            {
                $this->flush();

                $saved_settings = [];
            }
            else
            {
                foreach ($saved_settings as $key => $value)
                {
                    if ( ! array_key_exists($key, $default_settings))
                    {
                        if ( ! key_represents_an_array($key, $default_settings))
                        {
                            $this->forget($key);
                        }
                    }
                }
            }


            // update with new settings
            foreach ($default_settings as $key => $value)
            {
                if ( ! preg_key_exists($key, $saved_settings))
                {
                    // check if key does not represents an array and exists in saved settings
                    if ( ! key_represents_an_array($key, $saved_settings))
                    {
                        $this->set($key, $value);
                    }
                }
            }
        }
    }
public function clean ( $ params = [ ] ) { if ( ! empty ( $ this -> config [ 'primary_config_file' ] ) ) { $ default_settings = Arr :: dot ( Config :: get ( $ this -> config [ 'primary_config_file' ] ) ) ; $ saved_settings = Arr :: dot ( $ this -> getAll ( $ cache = false ) ) ; if ( array_key_exists ( 'flush' , $ params ) && $ params [ 'flush' ] == true ) { $ this -> flush ( ) ; $ saved_settings = [ ] ; } else { foreach ( $ saved_settings as $ key => $ value ) { if ( ! array_key_exists ( $ key , $ default_settings ) ) { if ( ! key_represents_an_array ( $ key , $ default_settings ) ) { $ this -> forget ( $ key ) ; } } } } // update with new settings foreach ( $ default_settings as $ key => $ value ) { if ( ! preg_key_exists ( $ key , $ saved_settings ) ) { // check if key does not represents an array and exists in saved settings if ( ! key_represents_an_array ( $ key , $ saved_settings ) ) { $ this -> set ( $ key , $ value ) ; } } } } }
Cleans settings that are no longer used in primary config file

@param $params
Cleans settings that are no longer used in primary config file