コード例 #1
0
 /**
  * @param CommandMessage $message
  * @return CommandHandler
  * @throws NoCommandHandlerFound
  */
 public function locate(CommandMessage $message)
 {
     $name = $message->name();
     if (!array_key_exists($name, $this->registry)) {
         throw NoCommandHandlerFound::forMessage($message);
     }
     return $this->registry[$name];
 }
コード例 #2
0
 /**
  * @param CommandMessage $message
  * @return CommandMessage
  */
 public function proceed(CommandMessage $message)
 {
     $this->processed = $message->name();
     return $message;
 }
コード例 #3
0
 /**
  * @param CommandMessage $message
  * @return static
  */
 public static function forMessage(CommandMessage $message)
 {
     return new static(sprintf('No handle method for command %s.', $message->name()));
 }