public function append($key, $value = null)
    {
        if (is_array($key)) {
            array_map([$this, __METHOD__], array_keys($key), $key);

            return $this;
        }

        $existing = $this->get($key);

        if (in_array($key, $this->toBeExploded)) {
            $existing = explode(' ', $existing);
            $value = is_array($value) ? $value : explode(' ', $value);
        }

        if (is_string($existing) && is_string($value)) {
            $value = $existing . ' ' . trim($value);
        } elseif (!is_null($existing)) {
            $value = array_merge((array)$existing, (array)$value);
        }

        $this->add($key, $value);

        return $this;
    }
public function append($key, $value = null)
    {
        if (is_array($key)) {
            array_map([$this, __METHOD__], array_keys($key), $key);

            return $this;
        }

        $existing = $this->get($key);

        if (in_array($key, $this->toBeExploded)) {
            $existing = explode(' ', $existing);
            $value = is_array($value) ? $value : explode(' ', $value);
        }

        if (is_string($existing) && is_string($value)) {
            $value = $existing . ' ' . trim($value);
        } elseif (!is_null($existing)) {
            $value = array_merge((array)$existing, (array)$value);
        }

        $this->add($key, $value);

        return $this;
    }
public function append ( $ key , $ value = null ) { if ( is_array ( $ key ) ) { array_map ( [ $ this , __METHOD__ ] , array_keys ( $ key ) , $ key ) ; return $ this ; } $ existing = $ this -> get ( $ key ) ; if ( in_array ( $ key , $ this -> toBeExploded ) ) { $ existing = explode ( ' ' , $ existing ) ; $ value = is_array ( $ value ) ? $ value : explode ( ' ' , $ value ) ; } if ( is_string ( $ existing ) && is_string ( $ value ) ) { $ value = $ existing . ' ' . trim ( $ value ) ; } elseif ( ! is_null ( $ existing ) ) { $ value = array_merge ( ( array ) $ existing , ( array ) $ value ) ; } $ this -> add ( $ key , $ value ) ; return $ this ; }
Appends a value.

If the existing value and the value to append are both strings, the
strings will be concatenated. In any other cases, an array of elements
will be created.

You can also pass an array with the keys and values as the only argument.
@param string|array $key Key or array with keys and values
@param mixed|null $value Value
@return $this
@uses add()
Appends a value .