public function __construct(Command $command) { if (empty($command->getEnvelope()->getReplyTo())) { throw InvalidArgumentException::forMissingCommandReplyTo($command); } $this->channel = $command->getQueue()->getChannel(); $this->routingKey = $command->getEnvelope()->getReplyTo(); $this->correlationId = $command->getEnvelope()->getCorrelationId(); }
public static function forMissingCommandReplyTo(Command $command) { return new static(sprintf('Expect command envelope to have a reply-to but "%s" was found', $command->getEnvelope()->getReplyTo())); }