/** * xapp option shortcut xapp_init_options initializes the passed options in first parameter according to second parameter * which can be of the following type: * 1) array = to use xapp option handling for array building * 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 * since the second parameter is passed as reference. * * @param array|Xapp_Option $options expects options to set * @param null|object|string $mixed expects value according to explanation above * @return null */ function xapp_init_options($options = null, &$mixed = null) { $options = (array) $options; if (is_array($mixed)) { $mixed = array_merge($mixed, $options); } else { if (xapped()) { Xapp::initOptions($options, $mixed); } else { if (is_object($mixed) && xapp_can_options($mixed)) { $mixed->options = array_merge($mixed->options, $options); } else { if (is_string($mixed) && xapp_can_options($mixed)) { $mixed::$options = array_merge($mixed::$options, $options); } } } } return null; }