Skip to content

Commit

Permalink
Made coding standard and other corrections to pull request 223
Browse files Browse the repository at this point in the history
  • Loading branch information
elazar committed Jul 1, 2012
1 parent 2934d31 commit 6c574b3
Showing 1 changed file with 29 additions and 34 deletions.
63 changes: 29 additions & 34 deletions Phergie/Plugin/PingPong.php
Expand Up @@ -12,51 +12,46 @@
* http://phergie.org/license
*
* @category Phergie
* @package Phergie_Plugin_Pong
* @package Phergie_Plugin_PingPong
* @author Phergie Development Team <team@phergie.org>
* @copyright 2008-2011 Phergie Development Team (http://phergie.org)
* @license http://phergie.org/license New BSD License
* @link http://pear.phergie.org/package/Phergie_Plugin_Pong
* @link http://pear.phergie.org/package/Phergie_Plugin_PingPong
*/

/**
* Responds with "$nick: pong" when some wrote "ping".
* Additionally responses with "$nick: passed" when someone wrote "test".
* Implements "test" and "ping" commands to test the bot's responsiveness.
*
* @category Phergie
* @package Phergie_Plugin_PingPong
* @author Marcel Glacki <Marcel.Glacki@stud.fh-swf.de>
* @author Phergie Development Team <team@phergie.org>
* @license http://phergie.org/license New BSD License
* @link http://pear.phergie.org/package/Phergie_Plugin_Pong
* @link http://irchelp.org/irchelp/rfc/chapter4.html#c4_6_2
* @link http://irchelp.org/irchelp/rfc/chapter4.html#c4_6_3
* @link http://pear.phergie.org/package/Phergie_Plugin_PingPong
*/
class Phergie_Plugin_PingPong extends Phergie_Plugin_Abstract
{
/**
* Responds to "ping" chatmessages.
*
* @return void
*/
public function onCommandPing( $args = NULL )
{
// Respond to "ping" only
// but not when a message starts with or contains "ping"
if( is_null( $args ))
$this->doPrivmsg( $this->event->getSource(),
$this->event->getNick().": pong" );
}
/**
* Responds to "test" chatmessages.
*
* @return void
*/
public function onCommandTest( $args = NULL )
{
// Respond to "test" only
// but not when a message starts with or contains "test"
if( is_null( $args ))
$this->doPrivmsg( $this->event->getSource(),
$this->event->getNick().": passed" );
}
/**
* Responds to "ping" messages.
*
* @return void
*/
public function onCommandPing()
{
$this->doPrivmsg(
$this->event->getSource(),
$this->event->getNick() . ': pong'
);
}
/**
* Responds to "test" messages.
*
* @return void
*/
public function onCommandTest()
{
$this->doPrivmsg(
$this->event->getSource(),
$this->event->getNick() . ': passed'
);
}
}

0 comments on commit 6c574b3

Please sign in to comment.