Example #1
0
/**
 * 
 * @param Item $item
 * @return string
 */
function consumableduration(Item $item)
{
    $ms = $item->getConsumableDurationMs();
    if ($ms) {
        $h = floor($ms / 3600000);
        $m = round($ms % 3600000 / 60000);
        if ($h && $m) {
            return $h . 'h' . $m . 'm';
        } elseif ($m) {
            return $m . 'm';
        } elseif ($h) {
            return $h . 'h';
        }
    }
    return '';
}