values = wp_parse_args($defaults, array( self::MIN_TASKS => self::DEFAULT_MIN_TASKS, self::MAX_TASKS => self::DEFAULT_MAX_TASKS, )); } /** * Check by the key if the configuration value does exist. * * @since 0.7 * @param string $key The configuration key used for the related value. * @return bool Whether a configuration value for the key is existing or not. */ public function has($key) { return isset($this->values[$key]); } /** * Set a new configuration value for the key. * * @since 0.7 * @param string $key The configuration key used for the related value. * @param mixed $value The configuration value for the key. * @return Configuration Returns the configuration which can be used for fluent interfaces. */ public function set($key, $value) { $this->values[$key] = $value; return $this; } /** * Set all configuration values for the keys. * * @since 0.9 * @param array $values The configuration values with all keys. * @return Configuration Returns the configuration which can be used for fluent interfaces. */ public function set_all($values) { foreach ($values as $key => $value) { $this->set($key, $value); } return $this; } /** * Delete an existing configuration value by the key. * * @since 0.7 * @param string $key The configuration key used for the related value. * @return Configuration Returns the configuration which can be used for fluent interfaces. */ public function delete($key) { unset($this->values[$key]); return $this; } /** * Get the configuration value by the key. * * @since 0.7 * @param string $key The configuration key used for the related value. * @return null|mixed The configuration value of the key. */ public function get($key) { return $this->has($key) ? $this->values[$key] : null; } /** * Get all configuration values. * * @since 0.7 * @return array The configuration values with all keys. */ public function get_all() { return $this->values; } }