示例#1
0
 public static function argv()
 {
     $cmd = new Commands();
     $argv = $_SERVER['argv'];
     $argc = $_SERVER['argc'];
     $cmd->version('Version: ' . self::VERSION);
     if ($argc == 2 && in_array($argv[1], array('--help', 'help'))) {
         $cmd->execute('help');
         $cmd->despliege('help');
         return $cmd;
     }
     return $argv;
 }
示例#2
0
 public static function add8ballCommand(Commands $moduleManager)
 {
     $moduleManager->registerCommand(new \Command('.8ball', function ($pBot, $sDestination, $sChannel, $sNickname, $aParams, $sMessage) {
         if (substr($sMessage, -1) != '?') {
             echo '!msg * Absurdity: Yours truly cordially beseeches thee to endow thine enquiry.';
             return;
         }
         // An array with the traditional old and new answers.
         $a_sAnswers = array('It is certain!', 'It is decidedly so!', 'Without a doubt!', 'Yes, definitely!', 'You may rely on it!', 'As I see it, yes!', 'Most likely!', 'Outlook good!', 'Yes!', 'Signs point to yes!', 'Reply hazy, try again.', 'Ask again later.', 'Better not tell you now.', 'Cannot predict now.', 'Concentrate and ask again.', 'Maybe.', 'Don\'t count on it!', 'My reply is no!', 'My sources say no!', 'Outlook not so good!', 'Very doubtful!', 'No!');
         $sAnswer = $a_sAnswers[mt_rand(0, count($a_sAnswers) - 1)];
         echo '!msg ' . $sNickname . ': ' . $sAnswer;
         return;
     }));
 }
示例#3
0
 public function daily_clean()
 {
     $get = new Commands();
     $expired = $get->verifyCurrent();
     $get->changeExpired($expired);
 }
示例#4
0
 protected function order($params)
 {
     $statusVariables = $this->statusVariables;
     if (empty($params['order'])) {
         throw new \Ip\Exception('Missing parameters');
     }
     if (empty($statusVariables['order']) || $statusVariables['order'] != $params['order']) {
         //new field selected to order records. Use ascending order
         $statusVariables['order'] = $params['order'];
         unset($statusVariables['direction']);
     } else {
         //the same field has been clicked repeatedly.
         if (empty($statusVariables['direction']) || $statusVariables['direction'] == 'asc') {
             //the same field has been clicked twice. Change order direction to descending
             $statusVariables['order'] = $params['order'];
             $statusVariables['direction'] = 'desc';
         } else {
             //the same field has been clicked for the third time. Remove ordering
             unset($statusVariables['order']);
             unset($statusVariables['direction']);
         }
     }
     $commands = array();
     $commands[] = Commands::setHash(Status::build($statusVariables));
     return $commands;
 }
示例#5
0
文件: Task.php 项目: vimac/zan
<?php

/**
 * Created by IntelliJ IDEA.
 * User: winglechen
 * Date: 15/11/9
 * Time: 13:37
 */
namespace Zan\Framework\Foundation\Coroutine;

//load commands
Commands::load();
class Task
{
    protected $taskId = 0;
    protected $parentId = 0;
    protected $coroutine = null;
    protected $context = null;
    protected $sendValue = null;
    protected $scheduler = null;
    protected $status = 0;
    public function __construct(\Generator $coroutine, $taskId = 0, $parentId = 0, Context $context = null)
    {
        $this->coroutine = $coroutine;
        $this->taskId = $taskId ? $taskId : TaskId::create();
        $this->parentId = $parentId;
        if ($context) {
            $this->context = $context;
        } else {
            $this->context = new Context();
        }