저자: Štěpán Svoboda
저자: Matěj Humpál
예제 #1
0
파일: Client.php 프로젝트: JerryCR/php-2
 /**
  * Finishes profiling.
  *
  * @param string $type Request type
  * @param string $method Method name
  * @param array $params Method parameters
  * @param mixed $response Server response
  * @return \Jyxo\Rpc\Client
  */
 protected function profileEnd($type, $method, array $params, $response)
 {
     // Profiling has to be turned on
     if ($this->profiler) {
         static $totalTime = 0;
         static $requests = array();
         // Get elapsed time
         $time = \Jyxo\Timer::stop($this->timer);
         $totalTime += $time;
         $requests[] = array(strtoupper($type), (string) $method, $params, $response, sprintf('%0.3f', $time * 1000));
         // Send to FirePHP
         \Jyxo\FirePhp::table(sprintf('Jyxo RPC Profiler (%d requests took %0.3f ms)', count($requests), sprintf('%0.3f', $totalTime * 1000)), array('Type', 'Method', 'Request', 'Response', 'Time'), $requests, 'Rpc');
     }
     return $this;
 }
예제 #2
0
파일: Executor.php 프로젝트: jyxo/php
 /**
  * Runs a single test.
  *
  * @param string $ident Test identifier
  * @return array
  * @throws \UnexpectedValueException If the test returned an unknown result value
  */
 private function runTest(string $ident) : array
 {
     // Runs the test
     $timer = \Jyxo\Timer::start();
     $result = $this->tests[$ident]->run();
     if (!$result instanceof \Jyxo\Beholder\Result) {
         throw new \UnexpectedValueException(sprintf('Result %s of the test %s is not a %s instance.', $result, $ident, \Jyxo\Beholder\Result::class));
     }
     // Returns result data
     return ['ident' => $ident, 'test' => $this->tests[$ident], 'result' => $result, 'duration' => \Jyxo\Timer::stop($timer)];
 }