Erebot  latest
A modular IRC bot for PHP 5.3+
Erebot\Interfaces\IrcCollator Interface Reference

Interface for a class handling an IRC collation. More...

+ Inheritance diagram for Erebot\Interfaces\IrcCollator:

Public Member Functions

 compare ($a, $b)
 
 limitedCompare ($a, $b, $len)
 
 normalizeNick ($nick)
 

Detailed Description

Interface for a class handling an IRC collation.

An IRC collation is used to compare different IRC objets, eg. two IRC nicknames, in order to find out whether they refer to the same thing or not.

Definition at line 32 of file IrcCollator.php.

Member Function Documentation

Erebot\Interfaces\IrcCollator::compare (   $a,
  $b 
)

Compares two string in a case-insensitive fashion (like strcasecmp).

Parameters
$aFirst string to compare.
$bSecond string to compare.
Return values
intAn integer less than, equal to or greater than zero if $a is found, respectively, to be less than, to match, or be greater than $b.

Implemented in Erebot\IrcCollator.

Erebot\Interfaces\IrcCollator::limitedCompare (   $a,
  $b,
  $len 
)

Compares two string in a case-insensitive fashion up to a given length (like strncasecmp).

Parameters
$aFirst string to compare.
$bSecond string to compare.
$lenLimit the comparison to only the first $len bytes of each string.
Return values
intAn integer less than, equal to or greater than zero if the first $len bytes of $a are found, respectively, to be less than, to match, or be greater than the first $len bytes of $b.

Implemented in Erebot\IrcCollator.

Erebot\Interfaces\IrcCollator::normalizeNick (   $nick)

Normalize (canonicalize) some IRC nickname.

This method can be used to compare two IRC nicknames like this:

if ($conn->normalizeNick($nick1) == $conn->normalizeNick($nick2)) {
// The two nicknames are considered equal.
}
Parameters
string$nickThe nickname to canonicalize.
Return values
stringA canonical representation of the nickname.
Warning
Make sure you use the same collation when comparing two nicknames or the result may be unpredictable.

Implemented in Erebot\IrcCollator.


The documentation for this interface was generated from the following file: