src/CLI/DeclareExchangeCommand.php
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $name = $input->getArgument('name');
        $type = $input->getArgument('type');
        Assertion::choice(
            $type,
            [
                Driver::EXCHANGE_TYPE_DIRECT,
                Driver::EXCHANGE_TYPE_TOPIC,
                Driver::EXCHANGE_TYPE_FANOUT,
                Driver::EXCHANGE_TYPE_HEADERS
            ],
            'The type of the exchange must be one of the four valid values.'
        );

        $this->driver->declareExchange($name, $type);
        $output->writeln(
            sprintf(
                '<info>Declare exchange <comment>%s</comment> [<comment>%s</comment>]</info>',
                $name,
                $type
            )
        );
    }
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $name = $input->getArgument('name');
        $type = $input->getArgument('type');
        Assertion::choice(
            $type,
            [
                Driver::EXCHANGE_TYPE_DIRECT,
                Driver::EXCHANGE_TYPE_TOPIC,
                Driver::EXCHANGE_TYPE_FANOUT,
                Driver::EXCHANGE_TYPE_HEADERS
            ],
            'The type of the exchange must be one of the four valid values.'
        );

        $this->driver->declareExchange($name, $type);
        $output->writeln(
            sprintf(
                '<info>Declare exchange <comment>%s</comment> [<comment>%s</comment>]</info>',
                $name,
                $type
            )
        );
    }
@param InputInterface  $input
@param OutputInterface $output

@return int|null|void

@throws InvalidArgumentException
@throws AssertionFailedException