You are here

private function StopwatchEvent::formatTime in Devel 8.3

Same name and namespace in other branches
  1. 8 webprofiler/src/Stopwatch.php \Drupal\webprofiler\StopwatchEvent::formatTime()
  2. 8.2 webprofiler/src/Stopwatch.php \Drupal\webprofiler\StopwatchEvent::formatTime()
  3. 4.x webprofiler/src/Stopwatch.php \Drupal\webprofiler\StopwatchEvent::formatTime()

Formats a time.

Parameters

int|float $time: A raw time.

Return value

float The formatted time.

Throws

\InvalidArgumentException When the raw time is not valid.

2 calls to StopwatchEvent::formatTime()
StopwatchEvent::getNow in webprofiler/src/Stopwatch.php
Return the current time relative to origin.
StopwatchEvent::__construct in webprofiler/src/Stopwatch.php
Constructor.

File

webprofiler/src/Stopwatch.php, line 535

Class

StopwatchEvent
Class StopwatchEvent.

Namespace

Drupal\webprofiler

Code

private function formatTime($time) {
  if (!is_numeric($time)) {
    throw new \InvalidArgumentException('The time must be a numerical value');
  }
  return round($time, 1);
}