jerodev /
php-irc-client
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace Jerodev\PhpIrcClient\Messages; |
||
| 6 | |||
| 7 | use Jerodev\PhpIrcClient\Helpers\Event; |
||
| 8 | use Jerodev\PhpIrcClient\IrcChannel; |
||
| 9 | use Jerodev\PhpIrcClient\IrcClient; |
||
| 10 | |||
| 11 | class NameReplyMessage extends IrcMessage |
||
| 12 | { |
||
| 13 | /** @var array<int, string> */ |
||
| 14 | public array $names; |
||
| 15 | |||
| 16 | public function __construct(string $message) |
||
| 17 | { |
||
| 18 | parent::__construct($message); |
||
| 19 | |||
| 20 | $this->channel = new IrcChannel(strstr($this->commandsuffix ?? '', '#')); |
||
| 21 | $this->names = explode(' ', $this->payload); |
||
| 22 | } |
||
| 23 | |||
| 24 | public function handle(IrcClient $client, bool $force = false): void |
||
| 25 | { |
||
| 26 | if ($this->handled && !$force) { |
||
| 27 | return; |
||
| 28 | } |
||
| 29 | |||
| 30 | if (!empty($this->names)) { |
||
| 31 | $client->getChannel($this->channel->getName()) |
||
|
0 ignored issues
–
show
|
|||
| 32 | ->setUsers($this->names); |
||
| 33 | } |
||
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * @return array<int, Event> |
||
| 38 | */ |
||
| 39 | public function getEvents(): array |
||
| 40 | { |
||
| 41 | return [ |
||
| 42 | new Event('names', [$this->channel, $this->names]), |
||
| 43 | new Event(sprintf('names%s', $this->channel->getName()), [$this->names]), |
||
| 44 | ]; |
||
| 45 | } |
||
| 46 | } |
||
| 47 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.