Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
41 / 41
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
DocPropsApp
100.00% covered (success)
100.00%
41 / 41
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 render
100.00% covered (success)
100.00%
41 / 41
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2/**
3 * This file is part of PHPPresentation - A pure PHP library for reading and writing
4 * presentations documents.
5 *
6 * PHPPresentation is free software distributed under the terms of the GNU Lesser
7 * General Public License version 3 as published by the Free Software Foundation.
8 *
9 * For the full copyright and license information, please read the LICENSE
10 * file that was distributed with this source code. For the full list of
11 * contributors, visit https://github.com/PHPOffice/PHPPresentation/contributors.
12 *
13 * @see        https://github.com/PHPOffice/PHPPresentation
14 *
15 * @license     http://www.gnu.org/licenses/lgpl.txt LGPL version 3
16 */
17
18declare(strict_types=1);
19
20namespace PhpOffice\PhpPresentation\Writer\PowerPoint2007;
21
22use PhpOffice\Common\Adapter\Zip\ZipInterface;
23use PhpOffice\Common\XMLWriter;
24
25class DocPropsApp extends AbstractDecoratorWriter
26{
27    public function render(): ZipInterface
28    {
29        // Create XML writer
30        $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY);
31
32        // XML header
33        $objWriter->startDocument('1.0', 'UTF-8', 'yes');
34
35        // Properties
36        $objWriter->startElement('Properties');
37        $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/officeDocument/2006/extended-properties');
38        $objWriter->writeAttribute('xmlns:vt', 'http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes');
39
40        // Application
41        $objWriter->writeElement('Application', 'Microsoft Office PowerPoint');
42
43        // Slides
44        $objWriter->writeElement('Slides', (string) $this->getPresentation()->getSlideCount());
45
46        // ScaleCrop
47        $objWriter->writeElement('ScaleCrop', 'false');
48
49        // HeadingPairs
50        $objWriter->startElement('HeadingPairs');
51
52        // Vector
53        $objWriter->startElement('vt:vector');
54        $objWriter->writeAttribute('size', '4');
55        $objWriter->writeAttribute('baseType', 'variant');
56
57        // Variant
58        $objWriter->startElement('vt:variant');
59        $objWriter->writeElement('vt:lpstr', 'Theme');
60        $objWriter->endElement();
61
62        // Variant
63        $objWriter->startElement('vt:variant');
64        $objWriter->writeElement('vt:i4', '1');
65        $objWriter->endElement();
66
67        // Variant
68        $objWriter->startElement('vt:variant');
69        $objWriter->writeElement('vt:lpstr', 'Slide Titles');
70        $objWriter->endElement();
71
72        // Variant
73        $objWriter->startElement('vt:variant');
74        $objWriter->writeElement('vt:i4', '1');
75        $objWriter->endElement();
76
77        $objWriter->endElement();
78
79        $objWriter->endElement();
80
81        // TitlesOfParts
82        $objWriter->startElement('TitlesOfParts');
83
84        // Vector
85        $objWriter->startElement('vt:vector');
86        $objWriter->writeAttribute('size', '1');
87        $objWriter->writeAttribute('baseType', 'lpstr');
88
89        $objWriter->writeElement('vt:lpstr', 'Office Theme');
90
91        $objWriter->endElement();
92
93        $objWriter->endElement();
94
95        // Company
96        $objWriter->writeElement('Company', $this->getPresentation()->getDocumentProperties()->getCompany());
97
98        // LinksUpToDate
99        $objWriter->writeElement('LinksUpToDate', 'false');
100
101        // SharedDoc
102        $objWriter->writeElement('SharedDoc', 'false');
103
104        // HyperlinksChanged
105        $objWriter->writeElement('HyperlinksChanged', 'false');
106
107        // AppVersion
108        $objWriter->writeElement('AppVersion', '12.0000');
109
110        $objWriter->endElement();
111
112        $this->oZip->addFromString('docProps/app.xml', $objWriter->getData());
113
114        // Return
115        return $this->oZip;
116    }
117}