Captioning\Format\JsonFile::parse PHP Метод

parse() публичный Метод

public parse ( )
    public function parse()
    {
        $decodedContent = json_decode($this->fileContent, true);
        if (!isset($decodedContent['captions'])) {
            throw new \InvalidArgumentException('Invalid JSON subtitle');
        }
        if (count($decodedContent['captions']) > 0) {
            foreach ($decodedContent['captions'] as $c) {
                $cue = new JsonCue($c['startTime'], $c['startTime'] + $c['duration'], $c['content']);
                $cue->setDuration($c['duration']);
                $cue->setStartOfParagraph($c['startOfParagraph']);
                $this->addCue($cue);
            }
        }
        return $this;
    }