Exemple #1
0
 protected function new_element_value(&$signal)
 {
     $element = $signal->data_element($this->from_data_key($signal));
     $sub = get_subelement($element, $this->from_sublevels);
     unset_subelement($element, $this->from_sublevels);
     $signal->set_data_element($element, $data_key);
     return $sub;
 }
function unset_subelement($compound, $subspath)
{
    if (empty($subspath) && !($subspath === 0)) {
        return NULL;
    }
    if (is_array($subspath)) {
        $level = array_shift($subspath);
    } else {
        $level = $subspath;
        $subspath = NULL;
    }
    if (is_array($compound) && array_key_exists($level, $compound)) {
        if (empty($subspath)) {
            unset($compound[$level]);
        } else {
            $compound[$level] = unset_subelement($compound[$level], $subspath);
        }
    } elseif (is_object($compound) && property_exists($level, $compound)) {
        if (empty($subspath)) {
            unset($compound->{$level});
        } else {
            $compound->{$level} = unset_subelement($compound[$level], $subspath);
        }
    }
    return $compound;
}
Exemple #3
0
 protected function new_element(&$signal)
 {
     $element = $signal->data_element($this->default_data_key);
     return unset_subelement($element, $this->sublevels);
 }