}
 function calcCommandAverage($duration)
 {
     $commandCount = NUMBER_OF_USERS * NUMBER_OF_TODO_PER_USER + NUMBER_OF_USERS;
     return $duration / $commandCount;
 }
 $container = (require 'config/container.php');
 $commandBus = $container->get(\Prooph\ServiceBus\CommandBus::class);
 $openTodos = [];
 $stopWatch = new Stopwatch();
 $stopWatch->start('generate_model');
 for ($i = 1; $i <= NUMBER_OF_USERS; $i++) {
     $userId = UserId::generate();
     $username = getUserName($i);
     $email = $username . '@acme.com';
     $commandBus->dispatch(RegisterUser::withData($userId->toString(), $username, $email));
     for ($j = 0; $j < NUMBER_OF_TODO_PER_USER; $j++) {
         $todoId = TodoId::generate();
         $commandBus->dispatch(PostTodo::forUser($userId->toString(), randTodoText(), $todoId->toString()));
         $openTodos[] = $todoId->toString();
     }
     echo "User: " . $username . "(" . $userId->toString() . ") was registered\n";
 }
 $generatedEvent = $stopWatch->stop('generate_model');
 echo "\nModel generated in: " . $generatedEvent->getDuration() . " ms\n";
 echo "Command execution average: " . calcCommandAverage($generatedEvent->getDuration()) . " ms\n";
 echo "\nGoing to close todo randomly now\n";
 foreach ($openTodos as $openTodoId) {
     $close = rand(0, 1);
     if ($close) {
         $commandBus->dispatch(MarkTodoAsDone::forTodo($openTodoId));
 /**
  * @param RegisterUser $command
  */
 public function __invoke(RegisterUser $command)
 {
     $user = User::registerWithData($command->userId(), $command->name(), $command->emailAddress());
     $this->userCollection->add($user);
 }