PHP Class Phergie_Plugin_Karma, phergie

Inheritance: extends Phergie_Plugin_Abstract
Afficher le fichier Open project: phergie/phergie

Protected Properties

Свойство Type Description
$db resource SQLite object
$fetchFixedKarma PDOStatement Retrieves an existing fixed karma record
$fetchKarma PDOStatement Retrieves an existing karma record
$fetchNegativeAnswer PDOStatement Retrieves a negative answer for a karma comparison
$fetchPositiveAnswer PDOStatement Retrieves a positive answer for a karma comparison
$insertKarma PDOStatement Prepared statement to add a new karma record
$updateKarma PDOStatement Prepared statement to update an existing karma record

Méthodes publiques

Méthode Description
getDb ( ) : PDO Returns a connection to the plugin database, initializing one if none is explicitly set.
onCommandKarma ( string $term ) : void Get the karma rating for a given term.
onCommandReincarnate ( string $term ) : void Resets the karma for a term to 0.
onLoad ( ) : void Check for dependencies and initializes a database connection and prepared statements.
onPrivmsg ( ) : void Intercepts a message and processes any contained recognized commands.
setDb ( PDO $db ) : Phergie_Plugin_Karma Sets the connection to the plugin database, mainly intended for unit testing.

Méthodes protégées

Méthode Description
compareKarma ( string $term0, string $term1, string $method ) : void Compares the karma between two terms. Optionally increases/decreases the karma of either term.
fetchFixedKarma ( string $term ) : string Returns a phrase describing the karma rating for a specified term for which the karma rating is fixed.
fetchKarma ( string $term ) : integer | boolean Returns the karma rating for a specified term for which the karma rating can be modified.
getCanonicalTerm ( string $term ) : string Get the canonical form of a given term.
initializePreparedStatements ( ) : void Initializes prepared statements used by the plugin.
modifyKarma ( string $term, string $action ) : integer Modifes a term's karma.

Method Details

compareKarma() protected méthode

Compares the karma between two terms. Optionally increases/decreases the karma of either term.
protected compareKarma ( string $term0, string $term1, string $method ) : void
$term0 string First term
$term1 string Second term
$method string Comparison method (< or >)
Résultat void

fetchFixedKarma() protected méthode

Returns a phrase describing the karma rating for a specified term for which the karma rating is fixed.
protected fetchFixedKarma ( string $term ) : string
$term string Term for which to fetch the corresponding karma rating
Résultat string Phrase describing the karma rating, which may be append to the term to form a complete response

fetchKarma() protected méthode

Returns the karma rating for a specified term for which the karma rating can be modified.
protected fetchKarma ( string $term ) : integer | boolean
$term string Term for which to fetch the corresponding karma rating
Résultat integer | boolean Integer value denoting the term's karma or FALSE if there is the specified term has no associated karma rating

getCanonicalTerm() protected méthode

In the canonical form all sequences of whitespace are replaced by a single space and all characters are lowercased.
protected getCanonicalTerm ( string $term ) : string
$term string Term for which a canonical form is required
Résultat string Canonical term

getDb() public méthode

Returns a connection to the plugin database, initializing one if none is explicitly set.
public getDb ( ) : PDO
Résultat PDO Database connection

initializePreparedStatements() protected méthode

Initializes prepared statements used by the plugin.
protected initializePreparedStatements ( ) : void
Résultat void

modifyKarma() protected méthode

Modifes a term's karma.
protected modifyKarma ( string $term, string $action ) : integer
$term string Term to modify
$action string Karma action (either ++ or --)
Résultat integer Modified karma rating

onCommandKarma() public méthode

Get the karma rating for a given term.
public onCommandKarma ( string $term ) : void
$term string Term for which the karma rating needs to be retrieved
Résultat void

onCommandReincarnate() public méthode

Resets the karma for a term to 0.
public onCommandReincarnate ( string $term ) : void
$term string Term for which to reset the karma rating
Résultat void

onLoad() public méthode

Check for dependencies and initializes a database connection and prepared statements.
public onLoad ( ) : void
Résultat void

onPrivmsg() public méthode

Intercepts a message and processes any contained recognized commands.
public onPrivmsg ( ) : void
Résultat void

setDb() public méthode

Sets the connection to the plugin database, mainly intended for unit testing.
public setDb ( PDO $db ) : Phergie_Plugin_Karma
$db PDO Database connection
Résultat Phergie_Plugin_Karma Provides a fluent interface

Property Details

$db protected_oe property

SQLite object
protected resource $db
Résultat resource

$fetchFixedKarma protected_oe property

Retrieves an existing fixed karma record
protected PDOStatement $fetchFixedKarma
Résultat PDOStatement

$fetchKarma protected_oe property

Retrieves an existing karma record
protected PDOStatement $fetchKarma
Résultat PDOStatement

$fetchNegativeAnswer protected_oe property

Retrieves a negative answer for a karma comparison
protected PDOStatement $fetchNegativeAnswer
Résultat PDOStatement

$fetchPositiveAnswer protected_oe property

Retrieves a positive answer for a karma comparison
protected PDOStatement $fetchPositiveAnswer
Résultat PDOStatement

$insertKarma protected_oe property

Prepared statement to add a new karma record
protected PDOStatement $insertKarma
Résultat PDOStatement

$updateKarma protected_oe property

Prepared statement to update an existing karma record
protected PDOStatement $updateKarma
Résultat PDOStatement