private function formatDuration($milliseconds)
    {
        $hours = floor($milliseconds / 1000 / 3600);
        $milliseconds -= ($hours * 3600 * 1000);

        $minutes = floor($milliseconds / 1000 / 60);
        $milliseconds -= ($minutes * 60 * 1000);

        $seconds = floor($milliseconds / 1000);
        $milliseconds -= ($seconds * 1000);

        $values = [
            'hour' => $hours,
            'minute' => $minutes,
            'second' => $seconds,
            'millisecond' => $milliseconds,
        ];

        $parts = [];

        foreach ($values as $text => $value) {
            if ($value > 0) {
                $parts[] = $value.' '.$text.($value > 1 ? 's' : '');
            }
        }

        return implode(' ', $parts);
    }
private function formatDuration($milliseconds)
    {
        $hours = floor($milliseconds / 1000 / 3600);
        $milliseconds -= ($hours * 3600 * 1000);

        $minutes = floor($milliseconds / 1000 / 60);
        $milliseconds -= ($minutes * 60 * 1000);

        $seconds = floor($milliseconds / 1000);
        $milliseconds -= ($seconds * 1000);

        $values = [
            'hour' => $hours,
            'minute' => $minutes,
            'second' => $seconds,
            'millisecond' => $milliseconds,
        ];

        $parts = [];

        foreach ($values as $text => $value) {
            if ($value > 0) {
                $parts[] = $value.' '.$text.($value > 1 ? 's' : '');
            }
        }

        return implode(' ', $parts);
    }
private function formatDuration ( $ milliseconds ) { $ hours = floor ( $ milliseconds / 1000 / 3600 ) ; $ milliseconds -= ( $ hours * 3600 * 1000 ) ; $ minutes = floor ( $ milliseconds / 1000 / 60 ) ; $ milliseconds -= ( $ minutes * 60 * 1000 ) ; $ seconds = floor ( $ milliseconds / 1000 ) ; $ milliseconds -= ( $ seconds * 1000 ) ; $ values = [ 'hour' => $ hours , 'minute' => $ minutes , 'second' => $ seconds , 'millisecond' => $ milliseconds , ] ; $ parts = [ ] ; foreach ( $ values as $ text => $ value ) { if ( $ value > 0 ) { $ parts [ ] = $ value . ' ' . $ text . ( $ value > 1 ? 's' : '' ) ; } } return implode ( ' ' , $ parts ) ; }
Method to format duration to human readable format.

@param int $milliseconds

@return string
Method to format duration to human readable format .