| @@ 13-64 (lines=52) @@ | ||
| 10 | /** |
|
| 11 | * Event dispatched whenever someone leaves a team |
|
| 12 | */ |
|
| 13 | class TeamAbandonEvent extends Event |
|
| 14 | { |
|
| 15 | /** |
|
| 16 | * @var \Team |
|
| 17 | */ |
|
| 18 | protected $team; |
|
| 19 | ||
| 20 | /** |
|
| 21 | * @var \Player |
|
| 22 | */ |
|
| 23 | protected $player; |
|
| 24 | ||
| 25 | /** |
|
| 26 | * Create a new event |
|
| 27 | * |
|
| 28 | * @param \Team $team The team that the player left |
|
| 29 | * @param \Player $player The player who abandoned the team |
|
| 30 | */ |
|
| 31 | public function __construct(\Team $team, \Player $player) |
|
| 32 | { |
|
| 33 | $this->team = $team; |
|
| 34 | $this->player = $player; |
|
| 35 | } |
|
| 36 | ||
| 37 | /** |
|
| 38 | * Get the team that the player abandoned |
|
| 39 | * |
|
| 40 | * @return \Team |
|
| 41 | */ |
|
| 42 | public function getTeam() |
|
| 43 | { |
|
| 44 | return $this->team; |
|
| 45 | } |
|
| 46 | ||
| 47 | /** |
|
| 48 | * Get the player who left the team |
|
| 49 | * |
|
| 50 | * @return \Player |
|
| 51 | */ |
|
| 52 | public function getPlayer() |
|
| 53 | { |
|
| 54 | return $this->player; |
|
| 55 | } |
|
| 56 | ||
| 57 | /** |
|
| 58 | * {@inheritdoc} |
|
| 59 | */ |
|
| 60 | public function notify($type) |
|
| 61 | { |
|
| 62 | $this->doNotify($this->team->getLeader(), $type); |
|
| 63 | } |
|
| 64 | } |
|
| 65 | ||
| @@ 13-64 (lines=52) @@ | ||
| 10 | /** |
|
| 11 | * Event dispatched whenever someone joins a team |
|
| 12 | */ |
|
| 13 | class TeamJoinEvent extends Event |
|
| 14 | { |
|
| 15 | /** |
|
| 16 | * @var \Team |
|
| 17 | */ |
|
| 18 | protected $team; |
|
| 19 | ||
| 20 | /** |
|
| 21 | * @var \Player |
|
| 22 | */ |
|
| 23 | protected $player; |
|
| 24 | ||
| 25 | /** |
|
| 26 | * Create a new event |
|
| 27 | * |
|
| 28 | * @param \Team $team The team that the player joined |
|
| 29 | * @param \Player $player The player who joined the team |
|
| 30 | */ |
|
| 31 | public function __construct(\Team $team, \Player $player) |
|
| 32 | { |
|
| 33 | $this->team = $team; |
|
| 34 | $this->player = $player; |
|
| 35 | } |
|
| 36 | ||
| 37 | /** |
|
| 38 | * Get the team that the player joined |
|
| 39 | * |
|
| 40 | * @return \Team |
|
| 41 | */ |
|
| 42 | public function getTeam() |
|
| 43 | { |
|
| 44 | return $this->team; |
|
| 45 | } |
|
| 46 | ||
| 47 | /** |
|
| 48 | * Get the player who joined the team |
|
| 49 | * |
|
| 50 | * @return \Player |
|
| 51 | */ |
|
| 52 | public function getPlayer() |
|
| 53 | { |
|
| 54 | return $this->player; |
|
| 55 | } |
|
| 56 | ||
| 57 | /** |
|
| 58 | * {@inheritdoc} |
|
| 59 | */ |
|
| 60 | public function notify($type) |
|
| 61 | { |
|
| 62 | $this->doNotify($this->team->getLeader(), $type); |
|
| 63 | } |
|
| 64 | } |
|
| 65 | ||
| @@ 13-64 (lines=52) @@ | ||
| 10 | /** |
|
| 11 | * Event dispatched whenever a new user is created |
|
| 12 | */ |
|
| 13 | class WelcomeEvent extends Event |
|
| 14 | { |
|
| 15 | /** |
|
| 16 | * @var string |
|
| 17 | */ |
|
| 18 | protected $message; |
|
| 19 | ||
| 20 | /** |
|
| 21 | * @var \Player |
|
| 22 | */ |
|
| 23 | protected $player; |
|
| 24 | ||
| 25 | /** |
|
| 26 | * Create a new event |
|
| 27 | * |
|
| 28 | * @param string $message The welcome message |
|
| 29 | * @param \Player $player The new player |
|
| 30 | */ |
|
| 31 | public function __construct($message, \Player $player) |
|
| 32 | { |
|
| 33 | $this->message = $message; |
|
| 34 | $this->player = $player; |
|
| 35 | } |
|
| 36 | ||
| 37 | /** |
|
| 38 | * Get the welcome message |
|
| 39 | * |
|
| 40 | * @return string |
|
| 41 | */ |
|
| 42 | public function getMessage() |
|
| 43 | { |
|
| 44 | return $this->message; |
|
| 45 | } |
|
| 46 | ||
| 47 | /** |
|
| 48 | * Get the new player |
|
| 49 | * |
|
| 50 | * @return \Player |
|
| 51 | */ |
|
| 52 | public function getPlayer() |
|
| 53 | { |
|
| 54 | return $this->player; |
|
| 55 | } |
|
| 56 | ||
| 57 | /** |
|
| 58 | * {@inheritdoc} |
|
| 59 | */ |
|
| 60 | public function notify($type) |
|
| 61 | { |
|
| 62 | return $this->doNotify($this->player, $type); |
|
| 63 | } |
|
| 64 | } |
|
| 65 | ||