/** * Sets the pattern associated with this filter. * * \param string $pattern * Pattern to use in text comparisons. * * \throw Erebot::InvalidValueException * The given value for $pattern is invalid. */ public function setPattern($pattern) { if (!\Erebot\Utils::stringifiable($pattern)) { throw new \Erebot\InvalidValueException('Pattern must be a string'); } $this->pattern = $pattern; }
/** * Sets the channel used in comparisons. * * \param $chan string|object * Channel to match incoming events against. * * \throw Erebot::InvalidValueException * The given chan is invalid. */ public function setChan($chan) { if (!\Erebot\Utils::stringifiable($chan)) { throw new \Erebot\InvalidValueException('Not a channel'); } $this->chan = $chan; }
/** * Sets the source used in comparisons. * * \param $source string|object * Source to match incoming events against. * * \throw Erebot::InvalidValueException * The given source is invalid. */ public function setSource($source) { if ($source !== null && !\Erebot\Utils::stringifiable($source)) { throw new \Erebot\InvalidValueException('Not a valid nickname'); } $this->source = $source; }
/** * Send a raw command to the IRC server. * * \param string $command * The command to send. */ protected function sendCommand($command) { if (!\Erebot\Utils::stringifiable($command)) { throw new \Exception('Invalid command (not a string)'); } $this->connection->getIO()->push((string) $command); }