format() public static méthode

Formats the elapsed time as a string.
public static format ( float $time ) : string
$time float
Résultat string
Exemple #1
0
 /**
  * Returns the resources (time, memory) of the request as a string.
  *
  * @param bool $getPeakMemory
  * @param bool $isRealMemory
  * @return string
  */
 public static function resourceUsage($getPeakMemory = true, $isRealMemory = false)
 {
     if ($getPeakMemory) {
         $message = 'Time: %s, Peak memory: %s';
         $memory = memory_get_peak_usage($isRealMemory);
     } else {
         $message = 'Time: %s, Memory: %s';
         $memory = memory_get_usage($isRealMemory);
     }
     $memory = FS::format($memory, 2);
     $time = Timer::format(Timer::timeSinceStart());
     return sprintf($message, $time, $memory);
 }
Exemple #2
0
 /**
  * @dataProvider secondsProvider
  * @param string $string
  * @param mixed  $seconds
  */
 public function testSecondsToTimeString($string, $seconds)
 {
     isSame($string, Timer::format($seconds));
 }