Completed
Pull Request — develop (#588)
by
unknown
08:47
created

PptPresProps   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 75
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Test Coverage

Coverage 96.97%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 5
dl 0
loc 75
ccs 32
cts 33
cp 0.9697
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B render() 0 68 2
1
<?php
2
namespace PhpOffice\PhpPresentation\Writer\PowerPoint2007;
3
4
use PhpOffice\Common\XMLWriter;
5
6
class PptPresProps extends AbstractDecoratorWriter
7
{
8
    /**
9
     * @return \PhpOffice\Common\Adapter\Zip\ZipInterface
10
     * @throws \Exception
11
     */
12 112
    public function render()
13
    {
14 112
        $presentationPpts = $this->oPresentation->getPresentationProperties();
15
16
        // Create XML writer
17 112
        $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY);
18
19
        // XML header
20 112
        $objWriter->startDocument('1.0', 'UTF-8', 'yes');
21
22
        // p:presentationPr
23 112
        $objWriter->startElement('p:presentationPr');
24 112
        $objWriter->writeAttribute('xmlns:a', 'http://schemas.openxmlformats.org/drawingml/2006/main');
25 112
        $objWriter->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships');
26 112
        $objWriter->writeAttribute('xmlns:p', 'http://schemas.openxmlformats.org/presentationml/2006/main');
27
28
        // p:presentationPr > p:showPr
29 112
        $objWriter->startElement('p:showPr');
30
31
        // loop attr
32 112
        if ($presentationPpts->isLoopContinuouslyUntilEsc()) {
33
            $objWriter->writeAttribute('loop', '1');
34
        }
35
36
        // show type
37 112
        $objWriter->startElement('p:'.$presentationPpts->getShowType());
38 112
        $objWriter->endElement();
39
        
40
        // > p:presentationPr > p:showPr
41 112
        $objWriter->endElement();
42
43
        // p:extLst
44 112
        $objWriter->startElement('p:extLst');
45
46
        // p:ext
47 112
        $objWriter->startElement('p:ext');
48 112
        $objWriter->writeAttribute('uri', '{E76CE94A-603C-4142-B9EB-6D1370010A27}');
49
50
        // p14:discardImageEditData
51 112
        $objWriter->startElement('p14:discardImageEditData');
52 112
        $objWriter->writeAttribute('xmlns:p14', 'http://schemas.microsoft.com/office/powerpoint/2010/main');
53 112
        $objWriter->writeAttribute('val', '0');
54 112
        $objWriter->endElement();
55
56
        // > p:ext
57 112
        $objWriter->endElement();
58
59
        // p:ext
60 112
        $objWriter->startElement('p:ext');
61 112
        $objWriter->writeAttribute('uri', '{D31A062A-798A-4329-ABDD-BBA856620510}');
62
63
        // p14:defaultImageDpi
64 112
        $objWriter->startElement('p14:defaultImageDpi');
65 112
        $objWriter->writeAttribute('xmlns:p14', 'http://schemas.microsoft.com/office/powerpoint/2010/main');
66 112
        $objWriter->writeAttribute('val', '220');
67 112
        $objWriter->endElement();
68
69
        // > p:ext
70 112
        $objWriter->endElement();
71
        // > p:extLst
72 112
        $objWriter->endElement();
73
        // > p:presentationPr
74 112
        $objWriter->endElement();
75
76 112
        $this->getZip()->addFromString('ppt/presProps.xml', $objWriter->getData());
77
78 112
        return $this->getZip();
79
    }
80
}
81