Captioning\Format\WebvttFile::buildPart PHP Method

buildPart() public method

public buildPart ( integer $_from, integer $_to )
$_from integer
$_to integer
    public function buildPart($_from, $_to)
    {
        $this->sortCues();
        $buffer = "WEBVTT";
        if ($this->fileDescription) {
            $buffer .= ' ' . $this->fileDescription;
        }
        $buffer .= $this->lineEnding;
        foreach ($this->regions as $region) {
            $buffer .= $region . $this->lineEnding;
        }
        $buffer .= $this->lineEnding;
        if ($_from < 0 || $_from >= $this->getCuesCount()) {
            $_from = 0;
        }
        if ($_to < 0 || $_to >= $this->getCuesCount()) {
            $_to = $this->getCuesCount() - 1;
        }
        for ($j = $_from; $j <= $_to; $j++) {
            $buffer .= $this->getCue($j) . $this->lineEnding;
        }
        $this->fileContent = $buffer;
        return $this;
    }