Represents the identity of an IRC user.
More...
|
| __construct ($user) |
|
| __toString () |
|
| getHost ($c10n) |
|
| getIdent () |
|
| getMask ($c10n) |
|
| getNick () |
|
| match ($pattern,\Erebot\Interfaces\IrcCollator $collator) |
|
|
| $host |
| Host part for this user identity, either a string or null.
|
|
| $ident |
| Identity string for this user identity, either a string or null.
|
|
| $nick |
| Nickname for this user identity, either a string or null.
|
|
Represents the identity of an IRC user.
Definition at line 27 of file Identity.php.
Erebot\Identity::__construct |
( |
|
$user | ) |
|
Creates a new object holding some user's identity.
- Parameters
-
string | $user | A string, representing some user. This can be either a mask, such as "foo!ident@host" or just a nickname, such as "foo". |
- Exceptions
-
Erebot::InvalidValueException | The given $user does not represent a valid identity. |
Definition at line 49 of file Identity.php.
static Erebot\Identity::canonicalizeHost |
( |
|
$host, |
|
|
|
$c10n, |
|
|
|
$uncompressed |
|
) |
| |
|
staticprotected |
Canonicalizes a host.
Despite its name, this method may be applied to either a hostname or an IP address (v4 or v6).
- Parameters
-
string | $host | Hostname or IP address to canonicalize. |
opaque | $c10n | The type of canonicalization to apply. This is either Erebot::Interfaces::Identity::CANON_IPV4 or Erebot::Interfaces::Identity::CANON_IPV6 depending on whether IPv6-mapped-IPv4 addresses should be rendered in dotted form or in the regular IPv6 form, respectively. |
bool | $uncompressed | Whether to compress IP addresses or not. In compressed form, leading zeros in a colon group are omitted and a series of groups with all-zeros is represented with just "::". |
- Return values
-
string | The original hostname or IP address in canonicalized (and optionally compressed) form. |
- Note
- The only transformation that is applied to hostnames as part of this canonicalization method is one that lowercases them.
- See Also
- See the various RFCs related to IP addresses for an exact description of the transformations that apply when compressing an IPv6 address.
Definition at line 165 of file Identity.php.
Erebot\Identity::match |
( |
|
$pattern, |
|
|
\Erebot\Interfaces\IrcCollator |
$collator |
|
) |
| |
Indicates whether this identity matches a given pattern.
- Parameters
-
string | $pattern | The pattern this identity should be tested against. The '?' and '*' wildcard characters are supported. |
Erebot::Interfaces::IrcCollator | $collator | Collator object to use to compare IRC nicknames. |
- Return values
-
bool | true if this identity matches the given pattern, false otherwise. |
Definition at line 326 of file Identity.php.
static Erebot\Identity::patternize |
( |
|
$pattern, |
|
|
|
$matchDot |
|
) |
| |
|
staticprotected |
Turn a basic pattern (optionally) containing wirldcards into a regular expression pattern, intended to match hostnames or IP addresses.
- Parameters
-
string | $pattern | Basic pattern, possibly containing wildcard characters ('*' and '?'). |
bool | $matchDot | Whether the '?' and '*' wildcard characters should also match dots '.' (true) or not (false). |
- Return values
-
string | A regular expression pattern that matches the criteria expressed in the original pattern. |
Definition at line 457 of file Identity.php.
static Erebot\Identity::stripLeading |
( |
& |
$number, |
|
|
|
$key |
|
) |
| |
|
staticprotected |
Strips leading '0' in front of a numeric string.
- Parameters
-
string | $number | Numeric string whose leading '0' should be stripped. Passed by reference and modified in-place. |
opaque | $key | Unused. |
- Returns
- Nothing ($number is modified in-place).
- Note
- This method is meant to be used with the array_walk() PHP function.
Definition at line 122 of file Identity.php.
The documentation for this class was generated from the following file: