PHP Класс Phergie_Plugin_Karma, phergie

Автор: Phergie Development Team ([email protected])
Наследование: extends Phergie_Plugin_Abstract
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
$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

Открытые методы

Метод Описание
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.

Защищенные методы

Метод Описание
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.

Описание методов

compareKarma() защищенный Метод

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 >)
Результат void

fetchFixedKarma() защищенный Метод

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
Результат string Phrase describing the karma rating, which may be append to the term to form a complete response

fetchKarma() защищенный Метод

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
Результат integer | boolean Integer value denoting the term's karma or FALSE if there is the specified term has no associated karma rating

getCanonicalTerm() защищенный Метод

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
Результат string Canonical term

getDb() публичный Метод

Returns a connection to the plugin database, initializing one if none is explicitly set.
public getDb ( ) : PDO
Результат PDO Database connection

initializePreparedStatements() защищенный Метод

Initializes prepared statements used by the plugin.
protected initializePreparedStatements ( ) : void
Результат void

modifyKarma() защищенный Метод

Modifes a term's karma.
protected modifyKarma ( string $term, string $action ) : integer
$term string Term to modify
$action string Karma action (either ++ or --)
Результат integer Modified karma rating

onCommandKarma() публичный Метод

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
Результат void

onCommandReincarnate() публичный Метод

Resets the karma for a term to 0.
public onCommandReincarnate ( string $term ) : void
$term string Term for which to reset the karma rating
Результат void

onLoad() публичный Метод

Check for dependencies and initializes a database connection and prepared statements.
public onLoad ( ) : void
Результат void

onPrivmsg() публичный Метод

Intercepts a message and processes any contained recognized commands.
public onPrivmsg ( ) : void
Результат void

setDb() публичный Метод

Sets the connection to the plugin database, mainly intended for unit testing.
public setDb ( PDO $db ) : Phergie_Plugin_Karma
$db PDO Database connection
Результат Phergie_Plugin_Karma Provides a fluent interface

Описание свойств

$db защищенное свойство

SQLite object
protected resource $db
Результат resource

$fetchFixedKarma защищенное свойство

Retrieves an existing fixed karma record
protected PDOStatement $fetchFixedKarma
Результат PDOStatement

$fetchKarma защищенное свойство

Retrieves an existing karma record
protected PDOStatement $fetchKarma
Результат PDOStatement

$fetchNegativeAnswer защищенное свойство

Retrieves a negative answer for a karma comparison
protected PDOStatement $fetchNegativeAnswer
Результат PDOStatement

$fetchPositiveAnswer защищенное свойство

Retrieves a positive answer for a karma comparison
protected PDOStatement $fetchPositiveAnswer
Результат PDOStatement

$insertKarma защищенное свойство

Prepared statement to add a new karma record
protected PDOStatement $insertKarma
Результат PDOStatement

$updateKarma защищенное свойство

Prepared statement to update an existing karma record
protected PDOStatement $updateKarma
Результат PDOStatement