/**
  * {@inheritdoc}
  */
 public function execute($command, callable $next)
 {
     if ($command instanceof Command) {
         $command = $this->transformer->transformEnvelopeToCommand($command->getEnvelope());
     } elseif ($command instanceof \AMQPEnvelope) {
         $command = $this->transformer->transformEnvelopeToCommand($command);
     }
     return $next($command);
 }
 /**
  * @test
  */
 public function it_should_pass_trough_none_amqp_commands()
 {
     $this->transformer->shouldNotReceive('transformEnvelopeToCommand');
     $command = new \stdClass();
     $this->execute($this->middleware, $command, $command);
 }