private function FeedsYouTubeFetcher::timeToDuration in Feeds: YouTube Parser 8
Convert YouTube video duration to time interval.
Parameters
string $duration: YouTube video duration.
Return value
string
1 call to FeedsYouTubeFetcher::timeToDuration()
- FeedsYouTubeFetcher::parseVideoItems in src/
Feeds/ Fetcher/ FeedsYouTubeFetcher.php - Parse a YouTube video feed.
File
- src/
Feeds/ Fetcher/ FeedsYouTubeFetcher.php, line 132
Class
- FeedsYouTubeFetcher
- Constructs FeedsYouTubeFetcher object.
Namespace
Drupal\feeds_youtube\Feeds\FetcherCode
private function timeToDuration($duration) {
$di = new \DateInterval($duration);
$string = '';
if ($di->h > 0) {
$string .= $di->h . ':';
}
return $string . $di->i . ':' . $di->s;
}