public function exchange($name, $options = [])
    {
        if (empty($this->_exchanges[$name])) {
            $channel = $this->channel($name, $options);
            $exchange = new AMQPExchange($channel);
            $exchange->setName($name);

            if (!empty($options['type'])) {
                $exchange->setType($options['type']);
            }

            if (!empty($options['flags'])) {
                $exchange->setFlags($options['flags']);
            }

            $this->_exchanges[$name] = $exchange;
        }

        return $this->_exchanges[$name];
    }
public function exchange($name, $options = [])
    {
        if (empty($this->_exchanges[$name])) {
            $channel = $this->channel($name, $options);
            $exchange = new AMQPExchange($channel);
            $exchange->setName($name);

            if (!empty($options['type'])) {
                $exchange->setType($options['type']);
            }

            if (!empty($options['flags'])) {
                $exchange->setFlags($options['flags']);
            }

            $this->_exchanges[$name] = $exchange;
        }

        return $this->_exchanges[$name];
    }
public function exchange ( $ name , $ options = [ ] ) { if ( empty ( $ this -> _exchanges [ $ name ] ) ) { $ channel = $ this -> channel ( $ name , $ options ) ; $ exchange = new AMQPExchange ( $ channel ) ; $ exchange -> setName ( $ name ) ; if ( ! empty ( $ options [ 'type' ] ) ) { $ exchange -> setType ( $ options [ 'type' ] ) ; } if ( ! empty ( $ options [ 'flags' ] ) ) { $ exchange -> setFlags ( $ options [ 'flags' ] ) ; } $ this -> _exchanges [ $ name ] = $ exchange ; } return $ this -> _exchanges [ $ name ] ; }
Connects to an exchange with the given name, the object returned
can be used to configure and create a new one.

@param string $name
@param array $options
@return AMQPExchange
Connects to an exchange with the given name the object returned can be used to configure and create a new one .