| Total Complexity | 5 |
| Total Lines | 43 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 8 | class PrivmsgMessage extends IrcMessage |
||
| 9 | { |
||
| 10 | /** @var IrcChannel */ |
||
| 11 | public $channel; |
||
| 12 | |||
| 13 | /** @var string */ |
||
| 14 | public $message; |
||
| 15 | |||
| 16 | /** @var string */ |
||
| 17 | public $target; |
||
| 18 | |||
| 19 | /** @var string */ |
||
| 20 | public $user; |
||
| 21 | |||
| 22 | public function __construct(string $message) |
||
| 28 | } |
||
| 29 | |||
| 30 | public function getEvents(): array |
||
| 31 | { |
||
| 32 | $events = []; |
||
| 33 | if ($this->target[0] === '#') { |
||
| 34 | $events = [ |
||
| 35 | new Event('message', [$this->user, $this->channel, $this->message]), |
||
| 36 | new Event("message$this->target", [$this->user, $this->channel, $this->message]), |
||
| 37 | ]; |
||
| 38 | } else { |
||
| 39 | $events = [ |
||
| 40 | new Event('privmsg', [$this->user, $this->target, $this->message]), |
||
| 41 | ]; |
||
| 42 | } |
||
| 43 | |||
| 44 | return $events; |
||
| 45 | } |
||
| 46 | |||
| 47 | public function injectChannel(array $channels): void |
||
| 51 | } |
||
| 52 | } |
||
| 54 |