public function remove($item)
    {
        if (is_string($item)) {
            // If there's no dot in the name, it's an exact property name and
            // we can just wipe out all those properties.
            //
            if (false === strpos($item, '.')) {
                unset($this->children[strtoupper($item)]);

                return;
            }
            // If there was a dot, we need to ask select() to help us out and
            // then we just call remove recursively.
            foreach ($this->select($item) as $child) {
                $this->remove($child);
            }
        } else {
            foreach ($this->select($item->name) as $k => $child) {
                if ($child === $item) {
                    unset($this->children[$item->name][$k]);

                    return;
                }
            }
        }

        throw new \InvalidArgumentException('The item you passed to remove() was not a child of this component');
    }
public function remove($item)
    {
        if (is_string($item)) {
            // If there's no dot in the name, it's an exact property name and
            // we can just wipe out all those properties.
            //
            if (false === strpos($item, '.')) {
                unset($this->children[strtoupper($item)]);

                return;
            }
            // If there was a dot, we need to ask select() to help us out and
            // then we just call remove recursively.
            foreach ($this->select($item) as $child) {
                $this->remove($child);
            }
        } else {
            foreach ($this->select($item->name) as $k => $child) {
                if ($child === $item) {
                    unset($this->children[$item->name][$k]);

                    return;
                }
            }
        }

        throw new \InvalidArgumentException('The item you passed to remove() was not a child of this component');
    }
public function remove ( $ item ) { if ( is_string ( $ item ) ) { // If there's no dot in the name, it's an exact property name and // we can just wipe out all those properties. // if ( false === strpos ( $ item , '.' ) ) { unset ( $ this -> children [ strtoupper ( $ item ) ] ) ; return ; } // If there was a dot, we need to ask select() to help us out and // then we just call remove recursively. foreach ( $ this -> select ( $ item ) as $ child ) { $ this -> remove ( $ child ) ; } } else { foreach ( $ this -> select ( $ item -> name ) as $ k => $ child ) { if ( $ child === $ item ) { unset ( $ this -> children [ $ item -> name ] [ $ k ] ) ; return ; } } } throw new \ InvalidArgumentException ( 'The item you passed to remove() was not a child of this component' ) ; }
This method removes a component or property from this component.

You can either specify the item by name (like DTSTART), in which case
all properties/components with that name will be removed, or you can
pass an instance of a property or component, in which case only that
exact item will be removed.

@param string|Property|Component $item
This method removes a component or property from this component .