BigName\EventDispatcher\Dispatcher::dispatch PHP Method

dispatch() public method

public dispatch ( $events )
    public function dispatch($events)
    {
        if (is_array($events)) {
            $this->fireEvents($events);
            return;
        }
        $this->fireEvent($events);
    }

Usage Example

 /**
  * Register a new user
  *
  * @param string $email
  * @param string $username
  * @param string $password
  * @return User
  */
 public function registerUser($email, $username, $password)
 {
     $email = new Email($email);
     $username = new Username($username);
     $password = new Password($password);
     $this->checkEmailIsUnique($email);
     $this->checkUsernameIsUnique($username);
     $id = $this->userRepository->nextIdentity();
     $password = $this->hashingService->hash($password);
     $user = User::register($id, $email, $username, $password);
     $this->userRepository->add($user);
     $this->dispatcher->dispatch($user->release());
     return $user;
 }
All Usage Examples Of BigName\EventDispatcher\Dispatcher::dispatch