PHP Class Phergie_Hostmask, phergie

Author: Phergie Development Team ([email protected])
Mostra file Open project: phergie/phergie Class Usage Examples

Protected Properties

Property Type Description
$host string Host
$nick string Nick
$regex string Regular expression used to parse a hostmask
$username string Username

Public Methods

Method 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 method

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
return void

__toString() public method

Returns the hostmask for the originating server or user.
public __toString ( ) : string
return string

fromString() public static method

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
return Phergie_Hostmask New instance populated with data parsed from the provided hostmask string

getHost() public method

Returns the hostname.
public getHost ( ) : string
return string

getNick() public method

Returns the nick of the user.
public getNick ( ) : string
return string

getUsername() public method

Returns the username of the user.
public getUsername ( ) : string
return string

isValid() public static method

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

matches() public method

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
return boolean TRUE if the hostmask matches the pattern, FALSE otherwise

setHost() public method

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

setNick() public method

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

setUsername() public method

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

Property Details

$host protected_oe property

Host
protected string $host
return string

$nick protected_oe property

Nick
protected string $nick
return string

$regex protected_oe static_oe property

Regular expression used to parse a hostmask
protected static string $regex
return string

$username protected_oe property

Username
protected string $username
return string