Represents the identity of an IRC user.
More...
|
|
| $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.
|
| |
|
|
const | CANON_IPV4 = 4 |
| | Use an IPv6 mapped IPv4 representation (eg. "::ffff:127.0.0.1").
|
| |
|
const | CANON_IPV6 = 6 |
| | Use a pure IPv6 representation (eg. "::ffff:7f00:1").
|
| |
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
-
Definition at line 49 of file Identity.php.
| Erebot\Identity::__toString |
( |
| ) |
|
This method works like Erebot::Interfaces::Identity::getNick(), except that if no information is available on the user's nickname, it should return a very distinctive value. Eg. an appropriate return value in such a case could be '?'.
- Return values
-
| string | This user's nickname or a distinctive value if it is not available. |
Implements Erebot\Interfaces\Identity.
Definition at line 307 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::getHost |
( |
|
$c10n | ) |
|
Returns the host of the user represented by this identity.
- Parameters
-
- Return values
-
| string | This user's hostname or null if unavailable. |
Implements Erebot\Interfaces\Identity.
Definition at line 289 of file Identity.php.
| Erebot\Identity::getIdent |
( |
| ) |
|
Returns the identity string of the user represented by this identity.
- Return values
-
| mixed | This user's identity string or NULL if unavailable. |
- Note
- The name of this method is somewhat misleading, as it returns the "identity" as defined by the user in his/her client. This is not the same as the "identity" represented here (which contains additional information). To try to disambiguate, the term "identity string" has been used when referring to the user-defined identity.
Implements Erebot\Interfaces\Identity.
Definition at line 98 of file Identity.php.
| Erebot\Identity::getMask |
( |
|
$c10n | ) |
|
Returns a mask which can later be used to match against this user.
- Parameters
-
- Return values
-
| string | A mask matching against this user. |
- Note
- Fields for which no value is available should be replaced with '*'. This can result in very generic masks (eg. "foo!*@*") if not enough information is known.
Implements Erebot\Interfaces\Identity.
Definition at line 300 of file Identity.php.
| Erebot\Identity::getNick |
( |
| ) |
|
Returns the nickname of the user represented by this identity.
- Return values
-
| mixed | This user's nickname or NULL if unavailable. |
Implements Erebot\Interfaces\Identity.
Definition at line 93 of file Identity.php.
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: