Beispiel #1
0
 /**
  * xapp option shortcut xapp_set_options sets options from first parameter to second parameter merging with existing
  * options where the second parameter can be:
  * 1) array = merging both together
  * 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
  * unlike xapp_init_options only data type will checked if used with xapp base class
  *
  * @param null|array|Xapp_Option $options expects options to set
  * @param null|object|string $mixed expects value according to explanation above
  * @return null|array the options array
  */
 function xapp_set_options($options = null, &$mixed = null)
 {
     if ($options !== null) {
         $options = (array) $options;
         if (is_array($mixed)) {
             return $mixed = array_merge($mixed, $options);
         } else {
             if (xapped()) {
                 return Xapp::setOptions($options, $mixed);
             } else {
                 if (is_object($mixed) && xapp_can_options($mixed)) {
                     return $mixed->options = array_merge($mixed->options, $options);
                 } else {
                     if (is_string($mixed) && xapp_can_options($mixed)) {
                         return $mixed::$options = array_merge($mixed::$options, $options);
                     }
                 }
             }
         }
     }
     return null;
 }