PHP Class Phergie_Hostmask, phergie

Author: Phergie Development Team ([email protected])
Afficher le fichier Open project: phergie/phergie Class Usage Examples

Protected Properties

Свойство Type Description
$host string Host
$nick string Nick
$regex string Regular expression used to parse a hostmask
$username string Username

Méthodes publiques

Méthode Description
__construct ( string $nick, string $username, string $host ) : void Constructor to initialize components of the hostmask.
__toString ( ) : string Returns the hostmask for the originating server or user.
fromString ( string $hostmask ) : Phergie_Hostmask Parses a string containing the entire hostmask into a new instance of this class.
getHost ( ) : string Returns the hostname.
getNick ( ) : string Returns the nick of the user.
getUsername ( ) : string Returns the username of the user.
isValid ( string $string ) : boolean Returns whether a given string appears to be a valid hostmask.
matches ( string $pattern, string $hostmask = null ) : boolean Returns whether a given hostmask matches a given pattern.
setHost ( string $host ) : Phergie_Hostmask Sets the hostname.
setNick ( string $nick ) : Phergie_Hostmask Sets the nick of the user.
setUsername ( string $username ) : Phergie_Hostmask Sets the username of the user.

Method Details

__construct() public méthode

Constructor to initialize components of the hostmask.
public __construct ( string $nick, string $username, string $host ) : void
$nick string Nick component
$username string Username component
$host string Host component
Résultat void

__toString() public méthode

Returns the hostmask for the originating server or user.
public __toString ( ) : string
Résultat string

fromString() public static méthode

Parses a string containing the entire hostmask into a new instance of this class.
public static fromString ( string $hostmask ) : Phergie_Hostmask
$hostmask string Entire hostmask including the nick, username, and host components
Résultat Phergie_Hostmask New instance populated with data parsed from the provided hostmask string

getHost() public méthode

Returns the hostname.
public getHost ( ) : string
Résultat string

getNick() public méthode

Returns the nick of the user.
public getNick ( ) : string
Résultat string

getUsername() public méthode

Returns the username of the user.
public getUsername ( ) : string
Résultat string

isValid() public static méthode

Returns whether a given string appears to be a valid hostmask.
public static isValid ( string $string ) : boolean
$string string Alleged hostmask string
Résultat boolean TRUE if the string appears to be a valid hostmask, FALSE otherwise

matches() public méthode

Returns whether a given hostmask matches a given pattern.
public matches ( string $pattern, string $hostmask = null ) : boolean
$pattern string Pattern using conventions of a ban mask where represents a wildcard
$hostmask string Optional hostmask to match against, if not the current hostmask instance
Résultat boolean TRUE if the hostmask matches the pattern, FALSE otherwise

setHost() public méthode

Sets the hostname.
public setHost ( string $host ) : Phergie_Hostmask
$host string Hostname
Résultat Phergie_Hostmask Provides a fluent interface

setNick() public méthode

Sets the nick of the user.
public setNick ( string $nick ) : Phergie_Hostmask
$nick string User nick
Résultat Phergie_Hostmask Provides a fluent interface

setUsername() public méthode

Sets the username of the user.
public setUsername ( string $username ) : Phergie_Hostmask
$username string Username
Résultat Phergie_Hostmask Provides a fluent interface

Property Details

$host protected_oe property

Host
protected string $host
Résultat string

$nick protected_oe property

Nick
protected string $nick
Résultat string

$regex protected_oe static_oe property

Regular expression used to parse a hostmask
protected static string $regex
Résultat string

$username protected_oe property

Username
protected string $username
Résultat string