Beispiel #1
0
 public static function defaultConverter(FileInterface $_file, $_convertTo)
 {
     $subtitleClass = __NAMESPACE__ . '\\Format\\' . ucfirst($_convertTo) . 'File';
     if (!class_exists($subtitleClass)) {
         throw new \InvalidArgumentException(sprintf('Unable to convert to "%s", this format does not exists.', $_convertTo));
     }
     $newSub = new $subtitleClass();
     $cueClass = File::getExpectedCueClass($newSub);
     foreach ($_file->getCues() as $cue) {
         $newSub->addCue($cue->getText(), $cueClass::ms2tc($cue->getStartMS()), $cueClass::ms2tc($cue->getStopMS()));
     }
     return $newSub;
 }