• Модуль: voximplant
  • Путь к файлу: ~/bitrix/modules/voximplant/lib/integration/report/handler/base.php
  • Класс: BitrixVoximplantIntegrationReportHandlerBase
  • Вызов: Base::formatDurationByMinutes
public function formatDurationByMinutes($duration)
{
	if ($duration == null)
	{
		return null;
	}

	$duration = (int)$duration;
	$hours = floor($duration / 60);
	$minutes = $duration - ($hours * 60);

	if ($hours < 1 && $minutes < 1)
	{
		return Loc::getMessage('TELEPHONY_REPORT_BASE_LESS_THAN_MINUTE');
	}

	$text = '';
	if ($hours > 0)
	{
		$text = $hours .' '. Loc::getMessage('TELEPHONY_REPORT_BASE_HOUR');
	}

	if ($minutes >= 1)
	{
		$minutesText = $minutes .' '. Loc::getMessage('TELEPHONY_REPORT_BASE_MIN');
		$text .= ($text === '' ? $minutesText : ', ' . $minutesText);
	}

	return $text;
}