public function remove($key = null)
    {
        if ($key instanceof PageInterface) {
            $key = $key->path();
        } elseif (null === $key) {
            $key = (string)key($this->items);
        }
        if (!\is_string($key)) {
            throw new \InvalidArgumentException('Invalid argument $key.');
        }

        parent::remove($key);

        return $this;
    }
public function remove($key = null)
    {
        if ($key instanceof PageInterface) {
            $key = $key->path();
        } elseif (null === $key) {
            $key = (string)key($this->items);
        }
        if (!\is_string($key)) {
            throw new \InvalidArgumentException('Invalid argument $key.');
        }

        parent::remove($key);

        return $this;
    }
public function remove ( $ key = null ) { if ( $ key instanceof PageInterface ) { $ key = $ key -> path ( ) ; } elseif ( null === $ key ) { $ key = ( string ) key ( $ this -> items ) ; } if ( ! \ is_string ( $ key ) ) { throw new \ InvalidArgumentException ( 'Invalid argument $key.' ) ; } parent :: remove ( $ key ) ; return $ this ; }
Remove item from the list.

@param PageInterface|string|null $key

@return $this
@throws \InvalidArgumentException
Remove item from the list .