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 TopicChangeMessage extends IrcMessage |
||
| 12 | { |
||
| 13 | public string $topic; |
||
| 14 | |||
| 15 | public function __construct(string $message) |
||
| 16 | { |
||
| 17 | parent::__construct($message); |
||
| 18 | $this->channel = new IrcChannel(strstr($this->commandsuffix ?? '', '#')); |
||
| 19 | $this->topic = $this->payload; |
||
| 20 | } |
||
| 21 | |||
| 22 | /** |
||
| 23 | * Change the topic for the referenced channel. |
||
| 24 | */ |
||
| 25 | public function handle(IrcClient $client, bool $force = false): void |
||
| 26 | { |
||
| 27 | if ($this->handled && !$force) { |
||
| 28 | return; |
||
| 29 | } |
||
| 30 | |||
| 31 | $client->getChannel($this->channel->getName())->setTopic($this->topic); |
||
|
0 ignored issues
–
show
|
|||
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @return array<int, Event> |
||
| 36 | */ |
||
| 37 | public function getEvents(): array |
||
| 38 | { |
||
| 39 | return [ |
||
| 40 | new Event('topic', [$this->channel, $this->topic]), |
||
| 41 | ]; |
||
| 42 | } |
||
| 43 | } |
||
| 44 |
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.