当前位置: 首页>>代码示例>>PHP>>正文


PHP Client::run方法代码示例

本文整理汇总了PHP中Client::run方法的典型用法代码示例。如果您正苦于以下问题:PHP Client::run方法的具体用法?PHP Client::run怎么用?PHP Client::run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Client的用法示例。


在下文中一共展示了Client::run方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testRunMaxSeconds

 public function testRunMaxSeconds()
 {
     $client = new Client();
     $client->connect();
     $s = microtime(true);
     $client->run(1.0);
     $e = microtime(true);
     $this->assertLessThan(2.0, $e - $s);
 }
开发者ID:Andrewsville,项目名称:bunny,代码行数:9,代码来源:ClientTest.php

示例2: run

 /**
  * @return array
  */
 public function run()
 {
     $this->results = [];
     foreach ($this->tests as $test) {
         $resultId = $this->client->run($test->test_id);
         $this->output($test->name . ' ');
         for ($i = 0; $i <= 20; $i++) {
             $result = $this->client->result($test->test_id, $resultId);
             if ($result->status === 'ready') {
                 $this->results[] = $result;
                 break;
             }
             $this->output('.');
             sleep(10);
         }
         $this->output(PHP_EOL);
     }
     return $this->results;
 }
开发者ID:shin1x1,项目名称:loaderio-runner,代码行数:22,代码来源:TestRunner.php

示例3: testClose

 public function testClose()
 {
     $c = new Client();
     $c->connect();
     $promise = $c->channel()->close();
     $this->assertInstanceOf("React\\Promise\\PromiseInterface", $promise);
     $promise->then(function () use($c) {
         $c->stop();
     });
     $c->run();
 }
开发者ID:mabrahamde,项目名称:bunny,代码行数:11,代码来源:ChannelTest.php

示例4: testRun

 public function testRun()
 {
     $client = new Client('test');
     $this->setExpectedException('Puppy\\Route\\RouteException', 'No route found for uri "/"');
     $client->run('/');
 }
开发者ID:raphhh,项目名称:puppy-client,代码行数:6,代码来源:ClientTest.php

示例5: addLog

     * @param str $log 日志内容
     * @return
     */
    protected function addLog($log)
    {
        $log = date("Y-m-d H:i:s") . " {$log} \n";
        file_put_contents($this->logFilePath, $log, FILE_APPEND | LOCK_EX);
        echo date("Y-m-d H:i:s") . " {$log} \n";
    }
    protected function get_files_by_ext($path, $ext)
    {
        $files = array();
        if (is_dir($path)) {
            $handle = opendir($path);
            while ($file = readdir($handle)) {
                if ($file[0] == '.') {
                    continue;
                }
                if (is_file($path . $file) && preg_match('/\\.' . $ext . '$/', $file)) {
                    $files[] = $file;
                }
            }
            closedir($handle);
            sort($files);
        }
        return $files;
    }
}
$obj = new Client();
$obj->run();
开发者ID:alice-jiao,项目名称:Practice,代码行数:30,代码来源:client.php

示例6: bindec

            $payloadLengthBin = str_split(sprintf('%016b', $payloadLength), 8);
            $frameHead[1] = $masked === true ? 254 : 126;
            $frameHead[2] = bindec($payloadLengthBin[0]);
            $frameHead[3] = bindec($payloadLengthBin[1]);
        } else {
            $frameHead[1] = $masked === true ? $payloadLength + 128 : $payloadLength;
        }
        // convert frame-head to string:
        foreach (array_keys($frameHead) as $i) {
            $frameHead[$i] = chr($frameHead[$i]);
        }
        if ($masked === true) {
            // generate a random mask:
            $mask = array();
            for ($i = 0; $i < 4; $i++) {
                $mask[$i] = chr(rand(0, 255));
            }
            $frameHead = array_merge($frameHead, $mask);
        }
        $frame = implode('', $frameHead);
        // append payload to frame:
        for ($i = 0; $i < $payloadLength; $i++) {
            $frame .= $masked === true ? $payload[$i] ^ $mask[$i % 4] : $payload[$i];
        }
        return $frame;
    }
}
$settings = array('host' => '0.0.0.0', 'port' => 10001, 'local' => 'http://liamka.me');
$Client = new Client($settings);
$Client->run();
开发者ID:ivan-mezentsev,项目名称:Web-Socket,代码行数:30,代码来源:_client.php

示例7: testRun

 public function testRun()
 {
     $client = new Client();
     $res = $client->run();
     $this->assertTrue($res);
 }
开发者ID:CodeProducer,项目名称:mytest,代码行数:6,代码来源:ClientTest.php


注:本文中的Client::run方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。