Beispiel #1
0
 /**
  * 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;
 }
Beispiel #2
0
 /**
  * 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;
 }
Beispiel #3
0
 /**
  * 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;
 }
Beispiel #4
0
 /**
  * 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);
 }