src/Document.php
private function createAdSection($type)
    {
        // Check Ad type
        $adTypeClassName = '\\Sokil\\Vast\\Ad\\' . $type;
        if (!class_exists($adTypeClassName)) {
            throw new \InvalidArgumentException(sprintf('Ad type %s not supported', $type));
        }
        
        // create dom node
        $adDomElement = $this->domDocument->createElement('Ad');
        $this->domDocument->documentElement->appendChild($adDomElement);

        // create type element
        $adTypeDomElement = $this->domDocument->createElement($type);
        $adDomElement->appendChild($adTypeDomElement);
        
        // create ad section
        $adSection = new $adTypeClassName($adDomElement);
        
        // cache
        $this->vastAdNodeList[] = $adSection;
        
        return $adSection;
    }
private function createAdSection($type)
    {
        // Check Ad type
        $adTypeClassName = '\\Sokil\\Vast\\Ad\\' . $type;
        if (!class_exists($adTypeClassName)) {
            throw new \InvalidArgumentException(sprintf('Ad type %s not supported', $type));
        }
        
        // create dom node
        $adDomElement = $this->domDocument->createElement('Ad');
        $this->domDocument->documentElement->appendChild($adDomElement);

        // create type element
        $adTypeDomElement = $this->domDocument->createElement($type);
        $adDomElement->appendChild($adTypeDomElement);
        
        // create ad section
        $adSection = new $adTypeClassName($adDomElement);
        
        // cache
        $this->vastAdNodeList[] = $adSection;
        
        return $adSection;
    }
private function createAdSection ( $ type ) { // Check Ad type $ adTypeClassName = '\\Sokil\\Vast\\Ad\\' . $ type ; if ( ! class_exists ( $ adTypeClassName ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Ad type %s not supported' , $ type ) ) ; } // create dom node $ adDomElement = $ this -> domDocument -> createElement ( 'Ad' ) ; $ this -> domDocument -> documentElement -> appendChild ( $ adDomElement ) ; // create type element $ adTypeDomElement = $ this -> domDocument -> createElement ( $ type ) ; $ adDomElement -> appendChild ( $ adTypeDomElement ) ; // create ad section $ adSection = new $ adTypeClassName ( $ adDomElement ) ; // cache $ this -> vastAdNodeList [ ] = $ adSection ; return $ adSection ; }
Create "Ad" section on "VAST" node

@param string $type

@throws \InvalidArgumentException

@return AbstractAdNode
Create Ad section on VAST node