WP_Super_Cache_Rest_Update_Settings::set_value_by_key() protected WPSCache 1.0
Given a key and a value, set the value for that key, based on the configuration in the settings map.
{} It's a method of the class: WP_Super_Cache_Rest_Update_Settings{}
No Hooks.
Return
String/null.
Usage
// protected - for code of main (parent) or child class $result = $this->set_value_by_key( $value, $key );
- $value(mixed) (required)
- $key(string) (required)
Code of WP_Super_Cache_Rest_Update_Settings::set_value_by_key() WP Super Cache Rest Update Settings::set value by key WPSCache 1.7.1
protected function set_value_by_key( $value, $key ) {
$settings_map = WP_Super_Cache_Settings_Map::$map;
// If this parameter isn't in the map, then let's ignore it.
if ( ! isset( $settings_map[ $key ] ) ) {
return null;
}
$map = $settings_map[ $key ];
if ( isset( $map['set'] ) ) {
if ( method_exists( $this, $map['set'] ) ) {
$has_error = call_user_func( array( $this, $map['set'] ), $value, $key );
} elseif ( function_exists( $map['set'] ) ) {
$has_error = call_user_func( $map['set'], $value );
}
} elseif ( isset( $map['global'] ) ) {
$set_method = method_exists( $this, 'set_' . $map['global'] ) ?
'set_' . $map['global'] : 'set_global';
if ( $set_method == 'set_global' ) {
$has_error = call_user_func( array( $this, $set_method ), $key, $value );
} else {
$has_error = call_user_func( array( $this, $set_method ), $value );
}
}
if ( ! empty( $has_error ) ) {
return $has_error;
}
return null;
}