public function append($name, $val = null, $merge = false)
    {
        if (is_array($name)) {
            foreach ($name as $key => $val) {
                if (isset($this->data[$key]) && !is_array($this->data[$key])) {
                    settype($this->data[$key], 'array');
                }

                if ($merge === true && is_array($val)) {
                    $this->data[$key] = $val + $this->data[$key];
                } else {
                    $this->data[$key][] = $val;
                }
            }
        } elseif ($val !== null) {
            if (isset($this->data[$name]) && !is_array($this->data[$name])) {
                settype($this->data[$name], 'array');
            } elseif (!isset($this->data[$name])) {
                $this->data[$name] = array();
            }

            if ($merge === true && is_array($val)) {
                $this->data[$name] = $val + $this->data[$name];
            } else {
                $this->data[$name][] = $val;
            }
        }
    }
public function append($name, $val = null, $merge = false)
    {
        if (is_array($name)) {
            foreach ($name as $key => $val) {
                if (isset($this->data[$key]) && !is_array($this->data[$key])) {
                    settype($this->data[$key], 'array');
                }

                if ($merge === true && is_array($val)) {
                    $this->data[$key] = $val + $this->data[$key];
                } else {
                    $this->data[$key][] = $val;
                }
            }
        } elseif ($val !== null) {
            if (isset($this->data[$name]) && !is_array($this->data[$name])) {
                settype($this->data[$name], 'array');
            } elseif (!isset($this->data[$name])) {
                $this->data[$name] = array();
            }

            if ($merge === true && is_array($val)) {
                $this->data[$name] = $val + $this->data[$name];
            } else {
                $this->data[$name][] = $val;
            }
        }
    }
public function append ( $ name , $ val = null , $ merge = false ) { if ( is_array ( $ name ) ) { foreach ( $ name as $ key => $ val ) { if ( isset ( $ this -> data [ $ key ] ) && ! is_array ( $ this -> data [ $ key ] ) ) { settype ( $ this -> data [ $ key ] , 'array' ) ; } if ( $ merge === true && is_array ( $ val ) ) { $ this -> data [ $ key ] = $ val + $ this -> data [ $ key ] ; } else { $ this -> data [ $ key ] [ ] = $ val ; } } } elseif ( $ val !== null ) { if ( isset ( $ this -> data [ $ name ] ) && ! is_array ( $ this -> data [ $ name ] ) ) { settype ( $ this -> data [ $ name ] , 'array' ) ; } elseif ( ! isset ( $ this -> data [ $ name ] ) ) { $ this -> data [ $ name ] = array ( ) ; } if ( $ merge === true && is_array ( $ val ) ) { $ this -> data [ $ name ] = $ val + $ this -> data [ $ name ] ; } else { $ this -> data [ $ name ] [ ] = $ val ; } } }
Appends values or an array of values to the data object.

@param array|string $name  an associative array of multiple (index=>value) or a string
that is the index to use, i.e. a value assigned to "foo" will be
accessible in the template through {$foo}
@param mixed        $val   the value to assign, or null if $name was an array
@param bool         $merge true to merge data or false to append, defaults to false
Appends values or an array of values to the data object .