/** * @expectedException \Mhor\MediaInfo\Exception\UnknownTrackTypeException */ public function testThrowInvalidTrackType() { $mediaInfoOutputParser = new MediaInfoOutputParser(); $mediaInfoOutputParser->parse(file_get_contents($this->invalidOutputPath)); // will throw exception here as default behavior $mediaInfoContainer = $mediaInfoOutputParser->getMediaInfoContainer(); }
/** * @param bool $ignoreUnknownTrackTypes Optional parameter used to skip unknown track types by passing true. The * default behavior (false) is throw an exception on unknown track types. * * @throws \Exception If this function is called before getInfoStartAsync() * @throws \Mhor\MediaInfo\Exception\UnknownTrackTypeException * * @return MediaInfoContainer */ public function getInfoWaitAsync($ignoreUnknownTrackTypes = false) { if ($this->mediaInfoCommandRunnerAsync == null) { throw new \Exception('You must run `getInfoStartAsync` before running `getInfoWaitAsync`'); } // blocks here until process is complete $output = $this->mediaInfoCommandRunnerAsync->wait(); $mediaInfoOutputParser = new MediaInfoOutputParser(); $mediaInfoOutputParser->parse($output); return $mediaInfoOutputParser->getMediaInfoContainer($ignoreUnknownTrackTypes); }