public function add()
    {
        $arguments = func_get_args();

        if ($arguments[0] instanceof Node) {
            if (isset($arguments[1])) {
                throw new \InvalidArgumentException('The second argument must not be specified, when passing a VObject Node');
            }
            $arguments[0]->parent = $this;
            $newNode = $arguments[0];
        } elseif (is_string($arguments[0])) {
            $newNode = call_user_func_array([$this->root, 'create'], $arguments);
        } else {
            throw new \InvalidArgumentException('The first argument must either be a \\Sabre\\VObject\\Node or a string');
        }

        $name = $newNode->name;
        if (isset($this->children[$name])) {
            $this->children[$name][] = $newNode;
        } else {
            $this->children[$name] = [$newNode];
        }

        return $newNode;
    }
public function add()
    {
        $arguments = func_get_args();

        if ($arguments[0] instanceof Node) {
            if (isset($arguments[1])) {
                throw new \InvalidArgumentException('The second argument must not be specified, when passing a VObject Node');
            }
            $arguments[0]->parent = $this;
            $newNode = $arguments[0];
        } elseif (is_string($arguments[0])) {
            $newNode = call_user_func_array([$this->root, 'create'], $arguments);
        } else {
            throw new \InvalidArgumentException('The first argument must either be a \\Sabre\\VObject\\Node or a string');
        }

        $name = $newNode->name;
        if (isset($this->children[$name])) {
            $this->children[$name][] = $newNode;
        } else {
            $this->children[$name] = [$newNode];
        }

        return $newNode;
    }
public function add ( ) { $ arguments = func_get_args ( ) ; if ( $ arguments [ 0 ] instanceof Node ) { if ( isset ( $ arguments [ 1 ] ) ) { throw new \ InvalidArgumentException ( 'The second argument must not be specified, when passing a VObject Node' ) ; } $ arguments [ 0 ] -> parent = $ this ; $ newNode = $ arguments [ 0 ] ; } elseif ( is_string ( $ arguments [ 0 ] ) ) { $ newNode = call_user_func_array ( [ $ this -> root , 'create' ] , $ arguments ) ; } else { throw new \ InvalidArgumentException ( 'The first argument must either be a \\Sabre\\VObject\\Node or a string' ) ; } $ name = $ newNode -> name ; if ( isset ( $ this -> children [ $ name ] ) ) { $ this -> children [ $ name ] [ ] = $ newNode ; } else { $ this -> children [ $ name ] = [ $ newNode ] ; } return $ newNode ; }
Adds a new property or component, and returns the new item.

This method has 3 possible signatures:

add(Component $comp) // Adds a new component
add(Property $prop)  // Adds a new property
add($name, $value, array $parameters = []) // Adds a new property
add($name, array $children = []) // Adds a new component
by name.

@return Node
Adds a new property or component and returns the new item .