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

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

public buildPart ( $_from, $_to )
    public function buildPart($_from, $_to)
    {
        $this->sortCues();
        if ($_from < 0 || $_from >= $this->getCuesCount()) {
            $_from = 0;
        }
        if ($_to < 0 || $_to >= $this->getCuesCount()) {
            $_to = $this->getCuesCount() - 1;
        }
        $captions = array();
        for ($j = $_from; $j <= $_to; $j++) {
            /** @var JsonCue $cue */
            $cue = $this->getCue($j);
            $captions[] = array('duration' => $cue->getDuration(), 'content' => $cue->getText(), 'startOfParagraph' => $cue->isStartOfParagraph(), 'startTime' => $cue->getStart());
        }
        $this->fileContent = json_encode(array('captions' => $captions));
        return $this;
    }