Captioning\Format\TtmlFile::parseCues PHP Метод

parseCues() приватный Метод

private parseCues ( $_xml )
    private function parseCues($_xml)
    {
        $start = '';
        $stop = '';
        $startMS = 0;
        $stopMS = 0;
        foreach ($_xml->div->p as $p) {
            if (self::TIMEBASE_MEDIA === $this->timeBase) {
                $start = (string) $p->attributes()->begin;
                $stop = (string) $p->attributes()->end;
                $startMS = (int) rtrim($start, 't') / $this->tickRate * 1000;
                $stopMS = (int) rtrim($stop, 't') / $this->tickRate * 1000;
            }
            $text = $p->asXml();
            $text = preg_replace('#^<p[^>]+>(.+)</p>$#isU', '$1', $text);
            $cue = new TtmlCue($start, $stop, $text);
            $cue->setStartMS($startMS);
            $cue->setStopMS($stopMS);
            $cue->setId((string) $p->attributes('xml', true)->id);
            if ($p->attributes()->style) {
                $cue->setStyle((string) $p->attributes()->style);
            }
            if ($p->attributes()->region) {
                $cue->setRegion((string) $p->attributes()->region);
            }
            $this->addCue($cue);
        }
    }