本文整理汇总了PHP中Command::doExecute方法的典型用法代码示例。如果您正苦于以下问题:PHP Command::doExecute方法的具体用法?PHP Command::doExecute怎么用?PHP Command::doExecute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Command
的用法示例。
在下文中一共展示了Command::doExecute方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doExecute
/**
* Says hello to the sender or first command parameter.
*/
public function doExecute()
{
parent::doExecute();
$sToBeGreeted = $this->getSender();
$aArgs = $this->getParameters();
// Checking if there is a name given that shall be greeted
if (isset($aArgs[2][0]) && !empty($aArgs[2][0])) {
$sToBeGreeted = $aArgs[2][0];
}
$this->setReturnMessage(Config::getInstance()->lang('WELCOME', $sToBeGreeted));
}
示例2: doExecute
/**
* Calculates current uptime of the bot
*/
public function doExecute()
{
parent::doExecute();
$oNow = new DateTime();
$oDifference = $this->__oStartDateTime->diff($oNow);
$iYears = $oDifference->format('%y');
$iDays = $oDifference->format('%d');
$iHours = $oDifference->format('%H');
$iMinutes = $oDifference->format('%I');
$sResponse = $iYears ? $iYears . ' ' . Config::getInstance()->lang('YEARS') . ', ' : '';
$sResponse .= $iDays ? $iDays . ' ' . Config::getInstance()->lang('DAYS') . ', ' : '';
$sResponse .= $iHours . ':' . $iMinutes . ' ' . Config::getInstance()->lang('HOURS');
$this->setReturnMessage($sResponse);
}
示例3: doExecute
/**
* Can be used as hook when a command is *really* executed.
*
* @return void
*/
public function doExecute()
{
parent::doExecute();
$sMessage = $this->getReceivedMessage();
$aArgs = $this->getParameters();
$sAction = $aArgs[2][0];
switch ($sAction) {
case 'join':
$this->addToQueue($this->getSender(), !empty($aArgs[4][0]) ? $aArgs[4][0] : $this->getSender());
break;
case 'get':
$this->getFromQueue(!empty($aArgs[4][0]) ? (int) $aArgs[4][0] : 1);
break;
case 'list':
$this->listAll();
break;
case 'clear':
$this->clearQueue();
break;
}
}
示例4: doExecute
/**
* Can be used as hook when a command is *really* executed.
*
* @return void
*/
public function doExecute()
{
parent::doExecute();
$this->setReturnMessage('Test successful!');
}