/** * All in one method * * @param int|array $duration Array of time segments or a number of seconds * @return string */ function toString($duration, $periods = null) { if (!is_array($duration)) { $duration = Duration::int2array($duration, $periods); } return Duration::array2string($duration); }