/** * xapp option shortcut xapp_set_option single option setter sets option from first parameter to third parameter as * part of the xapp option functionality. the third parameter can be: * 1) array = setting $key to $mixed * 2) object = object instance implementing xapp option handling or not * 3) string = object class name as string to handle static classes/options * 4) null = null when called inside class for xapp option handling for auto caller determination * * use the third parameter to reset the array before setting option. this will only have affect on class options * managed by xapp option handling * * @param null|string $key expects the option key name * @param null|mixed $value expects the option key value * @param null|object|string $mixed expects value according to explanation above * @param boolean $reset whether to reset before setting or not * @return null|mixed the just set option value */ function xapp_set_option($key = null, $value = null, &$mixed = null, $reset = false) { if ($key !== null) { if (is_array($mixed)) { return $mixed[$key] = $value; } else { if (xapped()) { return Xapp::setOption($key, $value, $mixed, $reset); } else { if (is_object($mixed) && xapp_can_options($mixed)) { return $mixed->options[$key] = $value; } else { if (is_string($mixed) && xapp_can_options($mixed)) { return $mixed::$options[$key] = $value; } } } } } return null; }