public function add($cookie): self
    {
        if ($cookie instanceof Cookie || $cookie instanceof SetCookie) {
            $clone                              = clone $this;
            $clone->cookies[$cookie->getName()] = $cookie;

            return $clone;
        }

        throw new InvalidArgumentException(\sprintf(
            'The object [%s] must be an instance of [%s] or [%s].',
            \get_class($cookie),
            Cookie::class,
            SetCookie::class
        ));
    }
public function add($cookie): self
    {
        if ($cookie instanceof Cookie || $cookie instanceof SetCookie) {
            $clone                              = clone $this;
            $clone->cookies[$cookie->getName()] = $cookie;

            return $clone;
        }

        throw new InvalidArgumentException(\sprintf(
            'The object [%s] must be an instance of [%s] or [%s].',
            \get_class($cookie),
            Cookie::class,
            SetCookie::class
        ));
    }
public function add ( $ cookie ) : self { if ( $ cookie instanceof Cookie || $ cookie instanceof SetCookie ) { $ clone = clone $ this ; $ clone -> cookies [ $ cookie -> getName ( ) ] = $ cookie ; return $ clone ; } throw new InvalidArgumentException ( \ sprintf ( 'The object [%s] must be an instance of [%s] or [%s].' , \ get_class ( $ cookie ) , Cookie :: class , SetCookie :: class ) ) ; }
Add a request cookie to the stack.

@param \Viserio\Component\Contract\Cookie\Cookie|\Viserio\Component\Cookie\Cookie $cookie

@throws \Viserio\Component\Contract\Cookie\Exception\InvalidArgumentException

@return $this
Add a request cookie to the stack .