Beispiel #1
0
 /**
  * xapp option shortcut xapp_unset_option will unset first parameter option $key from second parameter which can be:
  * 1) array = unset key from array
  * 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
  *
  * @param null|string $key expects the options key name to unset
  * @param null|object|string|array $mixed expects value according to explanation above
  * @return void
  */
 function xapp_unset_option($key = null, &$mixed = null)
 {
     if ($key !== null) {
         if (is_array($mixed)) {
             if (xapp_has_option($key, $mixed)) {
                 unset($mixed[$key]);
             }
         } else {
             if (xapped()) {
                 if (xapp_has_option($key, $mixed)) {
                     Xapp::unsetOption($key, $mixed);
                 }
             } else {
                 if (is_object($mixed) && xapp_can_options($mixed)) {
                     if (xapp_has_option($key, $mixed)) {
                         unset($mixed->options[$key]);
                     }
                 } else {
                     if (is_string($mixed) && xapp_can_options($mixed)) {
                         if (xapp_has_option($key, $mixed)) {
                             unset($mixed::$options[$key]);
                         }
                     }
                 }
             }
         }
     }
 }