@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | * @param string $nickname The nickname used on the IRC server. |
| 27 | 27 | * @param array<int, string> $channels The channels to join on connection. |
| 28 | 28 | */ |
| 29 | - public function __construct( |
|
| 29 | + public function __construct ( |
|
| 30 | 30 | public ?string $nickname = null, |
| 31 | 31 | public array $channels = [] |
| 32 | 32 | ) { |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | * Get the options for the IrcConnection from this collection. |
| 37 | 37 | * @return ConnectionOptions |
| 38 | 38 | */ |
| 39 | - public function connectionOptions(): ConnectionOptions |
|
| 39 | + public function connectionOptions (): ConnectionOptions |
|
| 40 | 40 | { |
| 41 | 41 | $options = new ConnectionOptions(); |
| 42 | 42 | $options->floodProtectionDelay = $this->floodProtectionDelay; |
@@ -6,7 +6,7 @@ |
||
| 6 | 6 | |
| 7 | 7 | class ConnectionOptions |
| 8 | 8 | { |
| 9 | - public function __construct(public int $floodProtectionDelay = 0) |
|
| 9 | + public function __construct (public int $floodProtectionDelay = 0) |
|
| 10 | 10 | { |
| 11 | 11 | } |
| 12 | 12 | } |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | */ |
| 16 | 16 | public string $user; |
| 17 | 17 | |
| 18 | - public function __construct(string $command) |
|
| 18 | + public function __construct (string $command) |
|
| 19 | 19 | { |
| 20 | 20 | parent::__construct($command); |
| 21 | 21 | [$this->user] = explode(' ', $command); |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | /** |
| 29 | 29 | * @return array<int, Event> |
| 30 | 30 | */ |
| 31 | - public function getEvents(): array |
|
| 31 | + public function getEvents (): array |
|
| 32 | 32 | { |
| 33 | 33 | return [ |
| 34 | 34 | new Event('invite', [$this->channel, $this->user]), |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | class MOTDMessage extends IrcMessage |
| 10 | 10 | { |
| 11 | - public function __construct(string $message) |
|
| 11 | + public function __construct (string $message) |
|
| 12 | 12 | { |
| 13 | 13 | parent::__construct($message); |
| 14 | 14 | } |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | /** |
| 17 | 17 | * @return array<int, Event> |
| 18 | 18 | */ |
| 19 | - public function getEvents(): array |
|
| 19 | + public function getEvents (): array |
|
| 20 | 20 | { |
| 21 | 21 | return [ |
| 22 | 22 | new Event('motd', [$this->payload]), |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | /** @var array<int, string> */ |
| 14 | 14 | public array $names; |
| 15 | 15 | |
| 16 | - public function __construct(string $message) |
|
| 16 | + public function __construct (string $message) |
|
| 17 | 17 | { |
| 18 | 18 | parent::__construct($message); |
| 19 | 19 | |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | $this->names = explode(' ', $this->payload); |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - public function handle(IrcClient $client, bool $force = false): void |
|
| 24 | + public function handle (IrcClient $client, bool $force = false): void |
|
| 25 | 25 | { |
| 26 | 26 | if ($this->handled && !$force) { |
| 27 | 27 | return; |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | /** |
| 37 | 37 | * @return array<int, Event> |
| 38 | 38 | */ |
| 39 | - public function getEvents(): array |
|
| 39 | + public function getEvents (): array |
|
| 40 | 40 | { |
| 41 | 41 | return [ |
| 42 | 42 | new Event('names', [$this->channel, $this->names]), |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | class PingMessage extends IrcMessage |
| 11 | 11 | { |
| 12 | - public function __construct(string $message) |
|
| 12 | + public function __construct (string $message) |
|
| 13 | 13 | { |
| 14 | 14 | parent::__construct($message); |
| 15 | 15 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | /** |
| 18 | 18 | * Reply the ping message with a pong response. |
| 19 | 19 | */ |
| 20 | - public function handle(IrcClient $client, bool $force = false): void |
|
| 20 | + public function handle (IrcClient $client, bool $force = false): void |
|
| 21 | 21 | { |
| 22 | 22 | if ($this->handled && !$force) { |
| 23 | 23 | return; |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | /** |
| 30 | 30 | * @return array<int, Event> |
| 31 | 31 | */ |
| 32 | - public function getEvents(): array |
|
| 32 | + public function getEvents (): array |
|
| 33 | 33 | { |
| 34 | 34 | return [ |
| 35 | 35 | new Event('ping'), |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | class WelcomeMessage extends IrcMessage |
| 11 | 11 | { |
| 12 | - public function __construct(string $message) |
|
| 12 | + public function __construct (string $message) |
|
| 13 | 13 | { |
| 14 | 14 | parent::__construct($message); |
| 15 | 15 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | /** |
| 18 | 18 | * On welcome message, join the selected channels. |
| 19 | 19 | */ |
| 20 | - public function handle(IrcClient $client, bool $force = false): void |
|
| 20 | + public function handle (IrcClient $client, bool $force = false): void |
|
| 21 | 21 | { |
| 22 | 22 | if ($this->handled && !$force) { |
| 23 | 23 | return; |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | /** |
| 32 | 32 | * @return array<int, Event> |
| 33 | 33 | */ |
| 34 | - public function getEvents(): array |
|
| 34 | + public function getEvents (): array |
|
| 35 | 35 | { |
| 36 | 36 | return [ |
| 37 | 37 | new Event('registered'), |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | { |
| 13 | 13 | public string $topic; |
| 14 | 14 | |
| 15 | - public function __construct(string $message) |
|
| 15 | + public function __construct (string $message) |
|
| 16 | 16 | { |
| 17 | 17 | parent::__construct($message); |
| 18 | 18 | $this->channel = new IrcChannel(strstr($this->commandsuffix ?? '', '#')); |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | /** |
| 23 | 23 | * Change the topic for the referenced channel. |
| 24 | 24 | */ |
| 25 | - public function handle(IrcClient $client, bool $force = false): void |
|
| 25 | + public function handle (IrcClient $client, bool $force = false): void |
|
| 26 | 26 | { |
| 27 | 27 | if ($this->handled && !$force) { |
| 28 | 28 | return; |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | /** |
| 35 | 35 | * @return array<int, Event> |
| 36 | 36 | */ |
| 37 | - public function getEvents(): array |
|
| 37 | + public function getEvents (): array |
|
| 38 | 38 | { |
| 39 | 39 | return [ |
| 40 | 40 | new Event('topic', [$this->channel, $this->topic]), |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | protected ?string $source = null; |
| 18 | 18 | public ?string $target = null; |
| 19 | 19 | |
| 20 | - public function __construct(protected string $command) |
|
| 20 | + public function __construct (protected string $command) |
|
| 21 | 21 | { |
| 22 | 22 | $this->parse($this->command); |
| 23 | 23 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | * @param IrcClient $client A reference to the irc client object |
| 30 | 30 | * @param bool $force Force handling this message even if already handled |
| 31 | 31 | */ |
| 32 | - public function handle(IrcClient $client, bool $force = false): void |
|
| 32 | + public function handle (IrcClient $client, bool $force = false): void |
|
| 33 | 33 | { |
| 34 | 34 | if ($this->handled && !$force) { |
| 35 | 35 | return; |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | * Get the events that should be invoked for this message. |
| 41 | 41 | * @return array<int, Event> |
| 42 | 42 | */ |
| 43 | - public function getEvents(): array |
|
| 43 | + public function getEvents (): array |
|
| 44 | 44 | { |
| 45 | 45 | return []; |
| 46 | 46 | } |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | * The messages can use this to gather information of the channel if needed. |
| 51 | 51 | * @param array<string, IrcChannel> $channels |
| 52 | 52 | */ |
| 53 | - public function injectChannel(array $channels): void |
|
| 53 | + public function injectChannel (array $channels): void |
|
| 54 | 54 | { |
| 55 | 55 | if (array_key_exists($this->target, $channels)) { |
| 56 | 56 | $this->channel = $channels[$this->target]; |
@@ -60,13 +60,13 @@ discard block |
||
| 60 | 60 | /** |
| 61 | 61 | * Parse the IRC command string to local properties. |
| 62 | 62 | */ |
| 63 | - protected function parse(string $command): void |
|
| 63 | + protected function parse (string $command): void |
|
| 64 | 64 | { |
| 65 | 65 | $command = trim($command); |
| 66 | 66 | $i = 0; |
| 67 | 67 | |
| 68 | 68 | if ($command[0] === ':' && false !== strpos($command, ' ')) { |
| 69 | - $i = (int)strpos($command, ' '); |
|
| 69 | + $i = (int) strpos($command, ' '); |
|
| 70 | 70 | $this->source = substr($command, 1, $i - 1); |
| 71 | 71 | |
| 72 | 72 | $i++; |