Captioning\Format\SBVFile::buildPart PHP Method

buildPart() public method

Builds file content from entry $_from to entry $_to
public buildPart ( integer $_from, integer $_to ) : SBVFile
$_from integer Id of the first entry
$_to integer Id of the last entry
return SBVFile
    public function buildPart($_from, $_to)
    {
        $this->sortCues();
        $buffer = '';
        if ($_from < 0 || $_from >= $this->getCuesCount()) {
            $_from = 0;
        }
        if ($_to < 0 || $_to >= $this->getCuesCount()) {
            $_to = $this->getCuesCount() - 1;
        }
        for ($j = $_from; $j <= $_to; $j++) {
            /** @var SBVCue $cue */
            $cue = $this->getCue($j);
            $buffer .= $cue->getTimeCodeString() . $this->lineEnding;
            $buffer .= $cue->getText() . $this->lineEnding;
            $buffer .= $this->lineEnding;
        }
        $this->fileContent = $buffer;
        return $this;
    }