function StopwatchEvent::formatTime

Formats a time.

Parameters

integer|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 477

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);
}