protected function renderOutline($parent, $outline)
    {
        $outlineSub = $parent->addChild('outline');
        $textIsPresent = false;
        foreach ($outline as $key => $value) {
            // Only outlines can be an array and so we consider children are also outline elements.
            if ($key === '@outlines' && is_array($value)) {
                foreach ($value as $outlineChild) {
                    $this->renderOutline($outlineSub, $outlineChild);
                }
                continue;
            } elseif (is_array($value)) {
                throw new Exceptions\RenderException('Type of outline elements cannot be array: ' . $key);
            }
            // Detect text attribute is present, that is good :)
            if ($key === 'text') {
                $textIsPresent = true;
            }
            $outlineSub->addAttribute($key, $value);
        }
        if (!$textIsPresent && $this->version == '2.0') {
            throw new Exceptions\RenderException('The text element must be present for all outlines (applies to version 2.0 only)');
        }
    }
protected function renderOutline($parent, $outline)
    {
        $outlineSub = $parent->addChild('outline');
        $textIsPresent = false;
        foreach ($outline as $key => $value) {
            // Only outlines can be an array and so we consider children are also outline elements.
            if ($key === '@outlines' && is_array($value)) {
                foreach ($value as $outlineChild) {
                    $this->renderOutline($outlineSub, $outlineChild);
                }
                continue;
            } elseif (is_array($value)) {
                throw new Exceptions\RenderException('Type of outline elements cannot be array: ' . $key);
            }
            // Detect text attribute is present, that is good :)
            if ($key === 'text') {
                $textIsPresent = true;
            }
            $outlineSub->addAttribute($key, $value);
        }
        if (!$textIsPresent && $this->version == '2.0') {
            throw new Exceptions\RenderException('The text element must be present for all outlines (applies to version 2.0 only)');
        }
    }
protected function renderOutline ( $ parent , $ outline ) { $ outlineSub = $ parent -> addChild ( 'outline' ) ; $ textIsPresent = false ; foreach ( $ outline as $ key => $ value ) { // Only outlines can be an array and so we consider children are also outline elements. if ( $ key === '@outlines' && is_array ( $ value ) ) { foreach ( $ value as $ outlineChild ) { $ this -> renderOutline ( $ outlineSub , $ outlineChild ) ; } continue ; } elseif ( is_array ( $ value ) ) { throw new Exceptions \ RenderException ( 'Type of outline elements cannot be array: ' . $ key ) ; } // Detect text attribute is present, that is good :) if ( $ key === 'text' ) { $ textIsPresent = true ; } $ outlineSub -> addAttribute ( $ key , $ value ) ; } if ( ! $ textIsPresent && $ this -> version == '2.0' ) { throw new Exceptions \ RenderException ( 'The text element must be present for all outlines (applies to version 2.0 only)' ) ; } }
Create a XML outline object in a parent object.

@param SimpleXMLElement $parent is the parent object of current outline
@param array $outline array representing an outline object
@return void
@throws Exceptions\RenderException
Create a XML outline object in a parent object .