/**
  * The message name is taken directly from the Envelope
  *
  * {@inheritdoc}
  */
 public function resolve(Message $envelope)
 {
     if (!$envelope instanceof EnvelopsEvent) {
         throw CouldNotResolveMessageName::forMessage($envelope, 'Message should be an instance of EnvelopsEvent');
     }
     return $envelope->eventName();
 }
 /**
  * {@inheritdoc}
  */
 public function resolve($message)
 {
     if (!$message instanceof NamedMessage) {
         throw CouldNotResolveMessageName::forMessage($message, 'Message should be an instance of NamedMessage');
     }
     $name = $message::messageName();
     if (!is_string($name) || empty($name)) {
         throw CouldNotResolveMessageName::forMessage($message, sprintf('Static method "%s::messageName()" should return a non-empty string', get_class($message)));
     }
     return $name;
 }