Apple_Exporter\Settings::set PHP Method

set() public method

Set a setting.
public set ( string $name, mixed $value ) : mixed
$name string
$value mixed
return mixed
    public function set($name, $value)
    {
        $this->settings[$name] = $value;
        return $value;
    }

Usage Example

 /**
  * Creates a new \Apple_Exporter\Settings instance and loads it with WordPress' saved
  * settings.
  */
 public function fetch_settings()
 {
     if (is_null($this->loaded_settings)) {
         $settings = new Settings();
         foreach ($settings->all() as $key => $value) {
             $wp_value = get_option($key);
             if (empty($wp_value)) {
                 $wp_value = $value;
             }
             $settings->set($key, $wp_value);
         }
         $this->loaded_settings = $settings;
     }
     return apply_filters('apple_news_loaded_settings', $this->loaded_settings);
 }