public function duration($seconds)
    {
        $result = [
            'hour'     => (int) floor($seconds / 3600),
            'min'      => (int) floor(($seconds / 60) % 60),
            'sec'      => $seconds % 60,
            'ms'       => (int) round(\fmod($seconds, 1) * 1000),
        ];

        $duration = '';
        foreach ($result as $unit => $value) {
            if (!empty($value) || $unit === 'ms') {
                $duration .= $value . "$unit ";
            }
        }

        $result['duration'] = trim($duration);

        return $result;
    }