protected static function time2String($time, $intervals)
{
$output = '';
foreach ($intervals as $name => $seconds) {
$num = floor($time / $seconds);
$time -= $num * $seconds;
if ($num > 0) {
$output .= $num . ' ' . $name . ($num > 1 ? 's' : '') . ' ';
}
}
return trim($output);
}