public function setTransport($name)
    {
        if (is_string($name)) {
            $transport = TransportFactory::get($name);
        } elseif (is_object($name)) {
            $transport = $name;
        } else {
            throw new InvalidArgumentException(
                sprintf('The value passed for the "$name" argument must be either a string, or an object, %s given.', gettype($name))
            );
        }
        if (!method_exists($transport, 'send')) {
            throw new LogicException(sprintf('The "%s" do not have send method.', get_class($transport)));
        }

        $this->_transport = $transport;

        return $this;
    }
public function setTransport($name)
    {
        if (is_string($name)) {
            $transport = TransportFactory::get($name);
        } elseif (is_object($name)) {
            $transport = $name;
        } else {
            throw new InvalidArgumentException(
                sprintf('The value passed for the "$name" argument must be either a string, or an object, %s given.', gettype($name))
            );
        }
        if (!method_exists($transport, 'send')) {
            throw new LogicException(sprintf('The "%s" do not have send method.', get_class($transport)));
        }

        $this->_transport = $transport;

        return $this;
    }
public function setTransport ( $ name ) { if ( is_string ( $ name ) ) { $ transport = TransportFactory :: get ( $ name ) ; } elseif ( is_object ( $ name ) ) { $ transport = $ name ; } else { throw new InvalidArgumentException ( sprintf ( 'The value passed for the "$name" argument must be either a string, or an object, %s given.' , gettype ( $ name ) ) ) ; } if ( ! method_exists ( $ transport , 'send' ) ) { throw new LogicException ( sprintf ( 'The "%s" do not have send method.' , get_class ( $ transport ) ) ) ; } $ this -> _transport = $ transport ; return $ this ; }
Sets the transport.

When setting the transport you can either use the name
of a configured transport or supply a constructed transport.

@param string|\Cake\Mailer\AbstractTransport $name Either the name of a configured
transport, or a transport instance.
@return $this
@throws \LogicException When the chosen transport lacks a send method.
@throws \InvalidArgumentException When $name is neither a string nor an object.
Sets the transport .