Completed
Pull Request — develop (#551)
by
unknown
09:20
created

PptSlides   F

Complexity

Total Complexity 85

Size/Duplication

Total Lines 947
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 15

Test Coverage

Coverage 66.67%

Importance

Changes 0
Metric Value
wmc 85
lcom 1
cbo 15
dl 0
loc 947
ccs 314
cts 471
cp 0.6667
rs 1.653
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A render() 0 21 5
F writeSlideRelationships() 0 315 63
B writeSlide() 0 145 4
C writeSlideAnimations() 0 313 9
B writeShapeDrawing() 0 114 4

How to fix   Complexity   

Complex Class

Complex classes like PptSlides often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

While breaking up the class, it is a good idea to analyze how other classes use PptSlides, and based on these observations, apply Extract Interface, too.

1
<?php
0 ignored issues
show
Coding Style introduced by
File has mixed line endings; this may cause incorrect results
Loading history...
Coding Style introduced by
End of line character is invalid; expected "\n" but found "\r\n"
Loading history...
2
3
namespace PhpOffice\PhpPresentation\Writer\PowerPoint2007;
4
5
use PhpOffice\Common\Drawing as CommonDrawing;
6
use PhpOffice\Common\XMLWriter;
7
use PhpOffice\PhpPresentation\Shape\Chart as ShapeChart;
8
use PhpOffice\PhpPresentation\Shape\Comment;
9
use PhpOffice\PhpPresentation\Shape\Drawing as ShapeDrawing;
10
use PhpOffice\PhpPresentation\Shape\Group;
11
use PhpOffice\PhpPresentation\Shape\Video;
12
use PhpOffice\PhpPresentation\Shape\Audio;
13
use PhpOffice\PhpPresentation\Shape\RichText;
14
use PhpOffice\PhpPresentation\Shape\RichText\Run;
15
use PhpOffice\PhpPresentation\Shape\RichText\TextElement;
16
use PhpOffice\PhpPresentation\Shape\Table as ShapeTable;
17
use PhpOffice\PhpPresentation\Slide;
18
use PhpOffice\PhpPresentation\Slide\Background\Image;
19
use PhpOffice\PhpPresentation\Slide\Note;
20
21
class PptSlides extends AbstractSlide {
22
	/**
23
	 * Add slides (drawings, ...) and slide relationships (drawings, ...)
24
	 * 
25
	 * @return \PhpOffice\Common\Adapter\Zip\ZipInterface
26
	 */
27 111
	public function render() {
28 111
		foreach ( $this->oPresentation->getAllSlides () as $idx => $oSlide ) {
0 ignored issues
show
Coding Style introduced by
Space found after opening bracket of FOREACH loop
Loading history...
Coding Style introduced by
Space found before closing bracket of FOREACH loop
Loading history...
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
29 111
			$this->oZip->addFromString ( 'ppt/slides/_rels/slide' . ($idx + 1) . '.xml.rels', $this->writeSlideRelationships ( $oSlide ) );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
30 111
			$this->oZip->addFromString ( 'ppt/slides/slide' . ($idx + 1) . '.xml', $this->writeSlide ( $oSlide ) );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
31
			
32
			// Add note slide
33 111
			if ($oSlide->getNote () instanceof Note) {
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
34 111
				if ($oSlide->getNote ()->getShapeCollection ()->count () > 0) {
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
35 1
					$this->oZip->addFromString ( 'ppt/notesSlides/notesSlide' . ($idx + 1) . '.xml', $this->writeNote ( $oSlide->getNote () ) );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
36
				}
37
			}
38
			
39
			// Add background image slide
40 111
			$oBkgImage = $oSlide->getBackground ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
41 111
			if ($oBkgImage instanceof Image) {
42 111
				$this->oZip->addFromString ( 'ppt/media/' . $oBkgImage->getIndexedFilename ( $idx ), file_get_contents ( $oBkgImage->getPath () ) );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
43
			}
44
		}
45
		
46 111
		return $this->oZip;
47
	}
48
	
49
	/**
50
	 * Write slide relationships to XML format
51
	 *
52
	 * @param \PhpOffice\PhpPresentation\Slide $pSlide        	
53
	 * @return string XML Output
54
	 * @throws \Exception
55
	 */
56 111
	protected function writeSlideRelationships(Slide $pSlide) {
57
		// @todo Group all getShapeCollection()->getIterator
58
		
59
		// Create XML writer
60 111
		$objWriter = new XMLWriter ( XMLWriter::STORAGE_MEMORY );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
61
		
62
		// XML header
63 111
		$objWriter->startDocument ( '1.0', 'UTF-8', 'yes' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
64
		
65
		// Relationships
66 111
		$objWriter->startElement ( 'Relationships' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
67 111
		$objWriter->writeAttribute ( 'xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
68
		
69
		// Starting relation id
70 111
		$relId = 1;
71 111
		$idxSlide = $pSlide->getParent ()->getIndex ( $pSlide );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
72
		
73
		// Write slideLayout relationship
74 111
		$layoutId = 1;
75 111
		if ($pSlide->getSlideLayout ()) {
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
76 111
			$layoutId = $pSlide->getSlideLayout ()->layoutNr;
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
77
		}
78 111
		$this->writeRelationship ( $objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout', '../slideLayouts/slideLayout' . $layoutId . '.xml' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
79 111
		++ $relId;
80
		
81
		// Write drawing relationships?
82 111
		if ($pSlide->getShapeCollection ()->count () > 0) {
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
83
			// Loop trough images and write relationships
84 84
			$iterator = $pSlide->getShapeCollection ()->getIterator ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
85 84
			while ( $iterator->valid () ) {
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
86 84
				if ($iterator->current () instanceof Video) {
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
87
					// Write relationship for image drawing
88
					$iterator->current ()->relationId = 'rId' . $relId;
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
89
					$this->writeRelationship ( $objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/video', '../media/' . $iterator->current ()->getIndexedFilename () );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
90
					++ $relId;
91
					$this->writeRelationship ( $objWriter, $relId, 'http://schemas.microsoft.com/office/2007/relationships/media', '../media/' . $iterator->current ()->getIndexedFilename () );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
92
					++ $relId;
93
					$filename = str_replace ( '.', '_', $iterator->current ()->getIndexedFilename () ) . '_bg.png';
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
94
					$this->writeRelationship ( $objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image', '../media/' . $filename );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
95
					++ $relId;
96 84
				} elseif ($iterator->current () instanceof Audio) {
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
97
					// Write relationship for image drawing
98
					$iterator->current ()->relationId = 'rId' . $relId;
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
99
					$this->writeRelationship ( $objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/audio', '../media/' . $iterator->current ()->getIndexedFilename () );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
100
					++ $relId;
101
					$this->writeRelationship ( $objWriter, $relId, 'http://schemas.microsoft.com/office/2007/relationships/media', '../media/' . $iterator->current ()->getIndexedFilename () );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
102
					++ $relId;
103
					$filename = str_replace ( '.', '_', $iterator->current ()->getIndexedFilename () ) . '_bg.png';
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
104
					$this->writeRelationship ( $objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image', '../media/' . $filename );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
105
					++ $relId;
106 84
				} elseif ($iterator->current () instanceof ShapeDrawing\AbstractDrawingAdapter) {
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
107
					// Write relationship for image drawing
108 8
					$this->writeRelationship ( $objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image', '../media/' . $iterator->current ()->getIndexedFilename () );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
109 8
					$iterator->current ()->relationId = 'rId' . $relId;
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
110 8
					++ $relId;
111 76
				} elseif ($iterator->current () instanceof ShapeChart) {
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
112
					// Write relationship for chart drawing
113 34
					$this->writeRelationship ( $objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart', '../charts/' . $iterator->current ()->getIndexedFilename () );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
114
					
115 34
					$iterator->current ()->relationId = 'rId' . $relId;
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
116
					
117 34
					++ $relId;
118 42
				} elseif ($iterator->current () instanceof Group) {
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
119 1
					$iterator2 = $iterator->current ()->getShapeCollection ()->getIterator ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
120 1
					while ( $iterator2->valid () ) {
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
121 1
						if ($iterator2->current () instanceof Video) {
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
122
							// Write relationship for image drawing
123
							$iterator2->current ()->relationId = 'rId' . $relId;
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
124
							$this->writeRelationship ( $objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/video', '../media/' . $iterator->current ()->getIndexedFilename () );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
125
							++ $relId;
126
							$this->writeRelationship ( $objWriter, $relId, 'http://schemas.microsoft.com/office/2007/relationships/media', '../media/' . $iterator->current ()->getIndexedFilename () );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
127
							++ $relId;
128
							$filename = str_replace ( '.', '_', $iterator->current ()->getIndexedFilename () ) . '_bg.png';
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
129
							$this->writeRelationship ( $objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image', '../media/' . $filename );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
130
							++ $relId;
131 1
						} elseif ($iterator->current () instanceof Audio) {
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
132
							// Write relationship for image drawing
133
							$iterator->current ()->relationId = 'rId' . $relId;
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
134
							$this->writeRelationship ( $objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/audio', '../media/' . $iterator->current ()->getIndexedFilename () );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
135
							++ $relId;
136
							$this->writeRelationship ( $objWriter, $relId, 'http://schemas.microsoft.com/office/2007/relationships/media', '../media/' . $iterator->current ()->getIndexedFilename () );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
137
							++ $relId;
138
							$filename = str_replace ( '.', '_', $iterator->current ()->getIndexedFilename () ) . '_bg.png';
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
139
							$this->writeRelationship ( $objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image', '../media/' . $filename );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
140
							++ $relId;
141 1
						} elseif ($iterator2->current () instanceof ShapeDrawing\AbstractDrawingAdapter) {
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
142
							// Write relationship for image drawing
143
							$this->writeRelationship ( $objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image', '../media/' . $iterator2->current ()->getIndexedFilename () );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
144
							$iterator2->current ()->relationId = 'rId' . $relId;
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
145
							
146
							++ $relId;
147 1
						} elseif ($iterator2->current () instanceof ShapeChart) {
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
148
							// Write relationship for chart drawing
149
							$this->writeRelationship ( $objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart', '../charts/' . $iterator2->current ()->getIndexedFilename () );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
150
							$iterator2->current ()->relationId = 'rId' . $relId;
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
151
							
152
							++ $relId;
153
						}
154 1
						$iterator2->next ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
155
					}
156
				}
157
				
158 84
				$iterator->next ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
159
			}
160
		}
161
		
162
		// Write background relationships?
163 111
		$oBackground = $pSlide->getBackground ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
164 111
		if ($oBackground instanceof Image) {
165
			$this->writeRelationship ( $objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image', '../media/' . $oBackground->getIndexedFilename ( $idxSlide ) );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
166
			$oBackground->relationId = 'rId' . $relId;
167
			++ $relId;
168
		}
169
		
170
		// Write hyperlink relationships?
171 111
		if ($pSlide->getShapeCollection ()->count () > 0) {
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
172
			// Loop trough hyperlinks and write relationships
173 84
			$iterator = $pSlide->getShapeCollection ()->getIterator ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
174 84
			while ( $iterator->valid () ) {
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
175
				// Hyperlink on shape
176 84
				if ($iterator->current ()->hasHyperlink ()) {
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
177
					// Write relationship for hyperlink
178 2
					$hyperlink = $iterator->current ()->getHyperlink ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
179 2
					$hyperlink->relationId = 'rId' . $relId;
180
					
181 2
					if (! $hyperlink->isInternal ()) {
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
182 2
						$this->writeRelationship ( $objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink', $hyperlink->getUrl (), 'External' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
183
					} else {
184
						$this->writeRelationship ( $objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide', 'slide' . $hyperlink->getSlideNumber () . '.xml' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
185
					}
186
					
187 2
					++ $relId;
188
				}
189
				
190
				// Hyperlink on rich text run
191 84
				if ($iterator->current () instanceof RichText) {
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
192 24
					foreach ( $iterator->current ()->getParagraphs () as $paragraph ) {
0 ignored issues
show
Coding Style introduced by
Space found after opening bracket of FOREACH loop
Loading history...
Coding Style introduced by
Space found before closing bracket of FOREACH loop
Loading history...
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
193 24
						foreach ( $paragraph->getRichTextElements () as $element ) {
0 ignored issues
show
Coding Style introduced by
Space found after opening bracket of FOREACH loop
Loading history...
Coding Style introduced by
Space found before closing bracket of FOREACH loop
Loading history...
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
194 19
							if ($element instanceof Run || $element instanceof TextElement) {
195 18
								if ($element->hasHyperlink ()) {
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
196
									// Write relationship for hyperlink
197 2
									$hyperlink = $element->getHyperlink ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
198 2
									$hyperlink->relationId = 'rId' . $relId;
199
									
200 2
									if (! $hyperlink->isInternal ()) {
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
201 1
										$this->writeRelationship ( $objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink', $hyperlink->getUrl (), 'External' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
202
									} else {
203 1
										$this->writeRelationship ( $objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide', 'slide' . $hyperlink->getSlideNumber () . '.xml' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
204
									}
205
									
206 24
									++ $relId;
207
								}
208
							}
209
						}
210
					}
211
				}
212
				
213
				// Hyperlink in table
214 84
				if ($iterator->current () instanceof ShapeTable) {
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
215
					// Rows
216 10
					$countRows = count ( $iterator->current ()->getRows () );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
217 10
					for($row = 0; $row < $countRows; $row ++) {
0 ignored issues
show
Coding Style introduced by
Expected 1 space after FOR keyword; 0 found
Loading history...
218
						// Cells in rows
219 10
						$countCells = count ( $iterator->current ()->getRow ( $row )->getCells () );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
220 10
						for($cell = 0; $cell < $countCells; $cell ++) {
0 ignored issues
show
Coding Style introduced by
Expected 1 space after FOR keyword; 0 found
Loading history...
221 10
							$currentCell = $iterator->current ()->getRow ( $row )->getCell ( $cell );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
222
							// Paragraphs in cell
223 10
							foreach ( $currentCell->getParagraphs () as $paragraph ) {
0 ignored issues
show
Coding Style introduced by
Space found after opening bracket of FOREACH loop
Loading history...
Coding Style introduced by
Space found before closing bracket of FOREACH loop
Loading history...
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
224
								// RichText in paragraph
225 10
								foreach ( $paragraph->getRichTextElements () as $element ) {
0 ignored issues
show
Coding Style introduced by
Space found after opening bracket of FOREACH loop
Loading history...
Coding Style introduced by
Space found before closing bracket of FOREACH loop
Loading history...
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
226
									// Run or Text in RichText
227 10
									if ($element instanceof Run || $element instanceof TextElement) {
228 10
										if ($element->hasHyperlink ()) {
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
229
											// Write relationship for hyperlink
230 1
											$hyperlink = $element->getHyperlink ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
231 1
											$hyperlink->relationId = 'rId' . $relId;
232
											
233 1
											if (! $hyperlink->isInternal ()) {
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
234 1
												$this->writeRelationship ( $objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink', $hyperlink->getUrl (), 'External' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
235
											} else {
236
												$this->writeRelationship ( $objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide', 'slide' . $hyperlink->getSlideNumber () . '.xml' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
237
											}
238
											
239 10
											++ $relId;
240
										}
241
									}
242
								}
243
							}
244
						}
245
					}
246
				}
247
				
248 84
				if ($iterator->current () instanceof Group) {
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
249 1
					$iterator2 = $pSlide->getShapeCollection ()->getIterator ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
250 1
					while ( $iterator2->valid () ) {
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
251
						// Hyperlink on shape
252 1
						if ($iterator2->current ()->hasHyperlink ()) {
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
253
							// Write relationship for hyperlink
254
							$hyperlink = $iterator2->current ()->getHyperlink ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
255
							$hyperlink->relationId = 'rId' . $relId;
256
							
257
							if (! $hyperlink->isInternal ()) {
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
258
								$this->writeRelationship ( $objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink', $hyperlink->getUrl (), 'External' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
259
							} else {
260
								$this->writeRelationship ( $objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide', 'slide' . $hyperlink->getSlideNumber () . '.xml' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
261
							}
262
							
263
							++ $relId;
264
						}
265
						
266
						// Hyperlink on rich text run
267 1
						if ($iterator2->current () instanceof RichText) {
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
268
							foreach ( $iterator2->current ()->getParagraphs () as $paragraph ) {
0 ignored issues
show
Coding Style introduced by
Space found after opening bracket of FOREACH loop
Loading history...
Coding Style introduced by
Space found before closing bracket of FOREACH loop
Loading history...
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
269
								foreach ( $paragraph->getRichTextElements () as $element ) {
0 ignored issues
show
Coding Style introduced by
Space found after opening bracket of FOREACH loop
Loading history...
Coding Style introduced by
Space found before closing bracket of FOREACH loop
Loading history...
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
270
									if ($element instanceof Run || $element instanceof TextElement) {
271
										if ($element->hasHyperlink ()) {
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
272
											// Write relationship for hyperlink
273
											$hyperlink = $element->getHyperlink ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
274
											$hyperlink->relationId = 'rId' . $relId;
275
											
276
											if (! $hyperlink->isInternal ()) {
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
277
												$this->writeRelationship ( $objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink', $hyperlink->getUrl (), 'External' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
278
											} else {
279
												$this->writeRelationship ( $objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide', 'slide' . $hyperlink->getSlideNumber () . '.xml' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
280
											}
281
											
282
											++ $relId;
283
										}
284
									}
285
								}
286
							}
287
						}
288
						
289
						// Hyperlink in table
290 1
						if ($iterator2->current () instanceof ShapeTable) {
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
291
							// Rows
292
							$countRows = count ( $iterator2->current ()->getRows () );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
293
							for($row = 0; $row < $countRows; $row ++) {
0 ignored issues
show
Coding Style introduced by
Expected 1 space after FOR keyword; 0 found
Loading history...
294
								// Cells in rows
295
								$countCells = count ( $iterator2->current ()->getRow ( $row )->getCells () );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
296
								for($cell = 0; $cell < $countCells; $cell ++) {
0 ignored issues
show
Coding Style introduced by
Expected 1 space after FOR keyword; 0 found
Loading history...
297
									$currentCell = $iterator2->current ()->getRow ( $row )->getCell ( $cell );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
298
									// Paragraphs in cell
299
									foreach ( $currentCell->getParagraphs () as $paragraph ) {
0 ignored issues
show
Coding Style introduced by
Space found after opening bracket of FOREACH loop
Loading history...
Coding Style introduced by
Space found before closing bracket of FOREACH loop
Loading history...
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
300
										// RichText in paragraph
301
										foreach ( $paragraph->getRichTextElements () as $element ) {
0 ignored issues
show
Coding Style introduced by
Space found after opening bracket of FOREACH loop
Loading history...
Coding Style introduced by
Space found before closing bracket of FOREACH loop
Loading history...
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
302
											// Run or Text in RichText
303
											if ($element instanceof Run || $element instanceof TextElement) {
304
												if ($element->hasHyperlink ()) {
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
305
													// Write relationship for hyperlink
306
													$hyperlink = $element->getHyperlink ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
307
													$hyperlink->relationId = 'rId' . $relId;
308
													
309
													if (! $hyperlink->isInternal ()) {
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
310
														$this->writeRelationship ( $objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink', $hyperlink->getUrl (), 'External' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
311
													} else {
312
														$this->writeRelationship ( $objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide', 'slide' . $hyperlink->getSlideNumber () . '.xml' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
313
													}
314
													
315
													++ $relId;
316
												}
317
											}
318
										}
319
									}
320
								}
321
							}
322
						}
323
						
324 1
						$iterator2->next ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
325
					}
326
				}
327
				
328 84
				$iterator->next ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
329
			}
330
		}
331
		
332
		// Write comment relationships
333 111
		if ($pSlide->getShapeCollection ()->count () > 0) {
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
334 84
			$hasSlideComment = false;
335
			
336
			// Loop trough images and write relationships
337 84
			$iterator = $pSlide->getShapeCollection ()->getIterator ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
338 84
			while ( $iterator->valid () ) {
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
339 84
				if ($iterator->current () instanceof Comment) {
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
340 6
					$hasSlideComment = true;
341 6
					break;
342 78
				} elseif ($iterator->current () instanceof Group) {
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
343 1
					$iterator2 = $iterator->current ()->getShapeCollection ()->getIterator ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
344 1
					while ( $iterator2->valid () ) {
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
345 1
						if ($iterator2->current () instanceof Comment) {
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
346 1
							$hasSlideComment = true;
347 1
							break 2;
348
						}
349
						$iterator2->next ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
350
					}
351
				}
352
				
353 77
				$iterator->next ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
354
			}
355
			
356 84
			if ($hasSlideComment) {
357 7
				$this->writeRelationship ( $objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments', '../comments/comment' . ($idxSlide + 1) . '.xml' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
358 7
				++ $relId;
359
			}
360
		}
361
		
362 111
		if ($pSlide->getNote ()->getShapeCollection ()->count () > 0) {
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
363 1
			$this->writeRelationship ( $objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide', '../notesSlides/notesSlide' . ($idxSlide + 1) . '.xml' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
364
		}
365
		
366 111
		$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
367
		
368
		// Return
369 111
		return $objWriter->getData ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
370
	}
371
	
372
	/**
373
	 * Write slide to XML format
374
	 *
375
	 * @param \PhpOffice\PhpPresentation\Slide $pSlide        	
376
	 * @return string XML Output
377
	 * @throws \Exception
378
	 */
379 111
	public function writeSlide(Slide $pSlide) {
380
		// Create XML writer
381 111
		$objWriter = new XMLWriter ( XMLWriter::STORAGE_MEMORY );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
382
		
383
		// XML header
384 111
		$objWriter->startDocument ( '1.0', 'UTF-8', 'yes' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
385
		
386
		// p:sld
387 111
		$objWriter->startElement ( 'p:sld' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
388 111
		$objWriter->writeAttribute ( 'xmlns:a', 'http://schemas.openxmlformats.org/drawingml/2006/main' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
389 111
		$objWriter->writeAttribute ( 'xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
390 111
		$objWriter->writeAttribute ( 'xmlns:p', 'http://schemas.openxmlformats.org/presentationml/2006/main' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
391 111
		$objWriter->writeAttributeIf ( ! $pSlide->isVisible (), 'show', 0 );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
392
		
393
		// p:sld/p:cSld
394 111
		$objWriter->startElement ( 'p:cSld' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
395
		
396
		// Background
397 111
		if ($pSlide->getBackground () instanceof Slide\AbstractBackground) {
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
398
			$oBackground = $pSlide->getBackground ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
399
			// p:bg
400
			$objWriter->startElement ( 'p:bg' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
401
			
402
			// p:bgPr
403
			$objWriter->startElement ( 'p:bgPr' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
404
			
405
			if ($oBackground instanceof Slide\Background\Color) {
406
				// a:solidFill
407
				$objWriter->startElement ( 'a:solidFill' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
408
				
409
				$this->writeColor ( $objWriter, $oBackground->getColor () );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
410
				
411
				// > a:solidFill
412
				$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
413
			}
414
			
415
			if ($oBackground instanceof Slide\Background\Image) {
416
				// a:blipFill
417
				$objWriter->startElement ( 'a:blipFill' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
418
				
419
				// a:blip
420
				$objWriter->startElement ( 'a:blip' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
421
				$objWriter->writeAttribute ( 'r:embed', $oBackground->relationId );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
422
				
423
				// > a:blipFill
424
				$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
425
				
426
				// a:stretch
427
				$objWriter->startElement ( 'a:stretch' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
428
				
429
				// a:fillRect
430
				$objWriter->writeElement ( 'a:fillRect' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
431
				
432
				// > a:stretch
433
				$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
434
				
435
				// > a:blipFill
436
				$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
437
			}
438
			
439
			// > p:bgPr
440
			$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
441
			
442
			// > p:bg
443
			$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
444
		}
445
		
446
		// p:spTree
447 111
		$objWriter->startElement ( 'p:spTree' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
448
		
449
		// p:nvGrpSpPr
450 111
		$objWriter->startElement ( 'p:nvGrpSpPr' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
451
		
452
		// p:cNvPr
453 111
		$objWriter->startElement ( 'p:cNvPr' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
454 111
		$objWriter->writeAttribute ( 'id', '1' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
455 111
		$objWriter->writeAttribute ( 'name', '' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
456 111
		$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
457
		
458
		// p:cNvGrpSpPr
459 111
		$objWriter->writeElement ( 'p:cNvGrpSpPr', null );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
460
		
461
		// p:nvPr
462 111
		$objWriter->writeElement ( 'p:nvPr', null );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
463
		
464 111
		$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
465
		
466
		// p:grpSpPr
467 111
		$objWriter->startElement ( 'p:grpSpPr' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
468
		
469
		// a:xfrm
470 111
		$objWriter->startElement ( 'a:xfrm' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
471
		
472
		// a:off
473 111
		$objWriter->startElement ( 'a:off' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
474 111
		$objWriter->writeAttribute ( 'x', CommonDrawing::pixelsToEmu ( $pSlide->getOffsetX () ) );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
475 111
		$objWriter->writeAttribute ( 'y', CommonDrawing::pixelsToEmu ( $pSlide->getOffsetY () ) );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
476 111
		$objWriter->endElement (); // a:off
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
477
		                          
478
		// a:ext
479 111
		$objWriter->startElement ( 'a:ext' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
480 111
		$objWriter->writeAttribute ( 'cx', CommonDrawing::pixelsToEmu ( $pSlide->getExtentX () ) );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
481 111
		$objWriter->writeAttribute ( 'cy', CommonDrawing::pixelsToEmu ( $pSlide->getExtentY () ) );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
482 111
		$objWriter->endElement (); // a:ext
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
483
		                          
484
		// a:chOff
485 111
		$objWriter->startElement ( 'a:chOff' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
486 111
		$objWriter->writeAttribute ( 'x', CommonDrawing::pixelsToEmu ( $pSlide->getOffsetX () ) );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
487 111
		$objWriter->writeAttribute ( 'y', CommonDrawing::pixelsToEmu ( $pSlide->getOffsetY () ) );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
488 111
		$objWriter->endElement (); // a:chOff
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
489
		                          
490
		// a:chExt
491 111
		$objWriter->startElement ( 'a:chExt' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
492 111
		$objWriter->writeAttribute ( 'cx', CommonDrawing::pixelsToEmu ( $pSlide->getExtentX () ) );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
493 111
		$objWriter->writeAttribute ( 'cy', CommonDrawing::pixelsToEmu ( $pSlide->getExtentY () ) );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
494 111
		$objWriter->endElement (); // a:chExt
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
495
		
496 111
		$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
497
		
498 111
		$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
499
		
500
		// Loop shapes
501 111
		$this->writeShapeCollection ( $objWriter, $pSlide->getShapeCollection () );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
502
		
503
		// TODO
504 111
		$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
505
		
506 111
		$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
507
		
508
		// p:clrMapOvr
509 111
		$objWriter->startElement ( 'p:clrMapOvr' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
510
		// p:clrMapOvr\a:masterClrMapping
511 111
		$objWriter->writeElement ( 'a:masterClrMapping', null );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
512
		// ##p:clrMapOvr
513 111
		$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
514
		
515 111
		$this->writeSlideTransition ( $objWriter, $pSlide->getTransition () );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
516
		
517 111
		$this->writeSlideAnimations ( $objWriter, $pSlide );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
518
		
519 111
		$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
520
		
521
		// Return
522 111
		return $objWriter->getData ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
523
	}
524
	
525
	/**
526
	 *
527
	 * @param XMLWriter $objWriter        	
528
	 * @param Slide $oSlide        	
529
	 */
530 111
	protected function writeSlideAnimations(XMLWriter $objWriter, Slide $oSlide) {
531 111
		$arrayAnimations = $oSlide->getAnimations ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
532 111
		if (empty ( $arrayAnimations )) {
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
533 110
			return;
534
		}
535
		
536
		// Variables
537 1
		$shapeId = 1;
538 1
		$idCount = 1;
539 1
		$hashToIdMap = array ();
540 1
		$arrayAnimationIds = array ();
541
		
542 1
		foreach ( $oSlide->getShapeCollection () as $shape ) {
0 ignored issues
show
Coding Style introduced by
Space found after opening bracket of FOREACH loop
Loading history...
Coding Style introduced by
Space found before closing bracket of FOREACH loop
Loading history...
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
543 1
			$hashToIdMap [$shape->getHashCode ()] = ++ $shapeId;
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
544
		}
545 1
		foreach ( $arrayAnimations as $oAnimation ) {
0 ignored issues
show
Coding Style introduced by
Space found after opening bracket of FOREACH loop
Loading history...
Coding Style introduced by
Space found before closing bracket of FOREACH loop
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
546 1
			foreach ( $oAnimation->getShapeCollection () as $oShape ) {
0 ignored issues
show
Coding Style introduced by
Space found after opening bracket of FOREACH loop
Loading history...
Coding Style introduced by
Space found before closing bracket of FOREACH loop
Loading history...
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
547 1
				$arrayAnimationIds [] = $hashToIdMap [$oShape->getHashCode ()];
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
548
			}
549
		}
550
		
551
		// p:timing
552 1
		$objWriter->startElement ( 'p:timing' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
553
		// p:timing/p:tnLst
554 1
		$objWriter->startElement ( 'p:tnLst' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
555
		// p:timing/p:tnLst/p:par
556 1
		$objWriter->startElement ( 'p:par' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
557
		// p:timing/p:tnLst/p:par/p:cTn
558 1
		$objWriter->startElement ( 'p:cTn' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
559 1
		$objWriter->writeAttribute ( 'id', $idCount ++ );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
560 1
		$objWriter->writeAttribute ( 'dur', 'indefinite' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
561 1
		$objWriter->writeAttribute ( 'restart', 'never' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
562 1
		$objWriter->writeAttribute ( 'nodeType', 'tmRoot' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
563
		// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst
564 1
		$objWriter->startElement ( 'p:childTnLst' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
565
		
566
		// Each animation has 1 shape
567 1
		foreach ( $arrayAnimations as $oAnimation ) {
0 ignored issues
show
Coding Style introduced by
Space found after opening bracket of FOREACH loop
Loading history...
Coding Style introduced by
Space found before closing bracket of FOREACH loop
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
568 1
			foreach ( $oAnimation->getShapeCollection () as $oShape ) {
0 ignored issues
show
Coding Style introduced by
Space found after opening bracket of FOREACH loop
Loading history...
Coding Style introduced by
Space found before closing bracket of FOREACH loop
Loading history...
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
569 1
				$shapeId = $hashToIdMap [$oShape->getHashCode ()];
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
570 1
				$shape = $oShape;
571
			}
572
			
573
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq
574 1
			$objWriter->startElement ( 'p:seq' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
575 1
			$objWriter->writeAttribute ( 'concurrent', '1' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
576 1
			$objWriter->writeAttribute ( 'nextAc', 'seek' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
577
			
578
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn
579 1
			$objWriter->startElement ( 'p:cTn' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
580 1
			$objWriter->writeAttribute ( 'id', $idCount ++ );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
581 1
			$objWriter->writeAttribute ( 'restart', 'whenNotActive' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
582 1
			$objWriter->writeAttribute ( 'fill', 'hold' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
583 1
			$objWriter->writeAttribute ( 'evtFilter', 'cancelBubble' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
584 1
			$objWriter->writeAttribute ( 'nodeType', 'interactiveSeq' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
585
			
586
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:stCondLst
587 1
			$objWriter->startElement ( 'p:stCondLst' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
588
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:stCondLst/p:cond
589 1
			$objWriter->startElement ( 'p:cond' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
590 1
			$objWriter->writeAttribute ( 'evt', 'onClick' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
591 1
			$objWriter->writeAttribute ( 'delay', '0' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
592
			
593
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:stCondLst/p:cond/p:tgtEl
594 1
			$objWriter->startElement ( 'p:tgtEl' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
595
			
596
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:stCondLst/p:cond/p:tgtEl/p:spTgt
597 1
			$objWriter->startElement ( 'p:spTgt' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
598 1
			$objWriter->writeAttribute ( 'spid', $shapeId );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
599 1
			$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
600
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:stCondLst/p:cond/p:tgtEl
601 1
			$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
602
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:stCondLst/p:cond/
603 1
			$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
604
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:stCondLst
605 1
			$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
606
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/
607
			
608 1
			$objWriter->startElement ( 'p:endSync' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
609
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:endSync/
610 1
			$objWriter->writeAttribute ( 'evt', 'end' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
611 1
			$objWriter->writeAttribute ( 'delay', 0 );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
612
			
613 1
			$objWriter->startElement ( 'p:rtn' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
614
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:endSync/p:rtn/
615 1
			$objWriter->writeAttribute ( 'val', 'all' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
616 1
			$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
617
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:endSync/
618 1
			$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
619
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/
620
			
621 1
			$objWriter->startElement ( 'p:childTnLst' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
622
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par
623 1
			$objWriter->startElement ( 'p:par' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
624
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn
625 1
			$objWriter->startElement ( 'p:cTn' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
626 1
			$objWriter->writeAttribute ( 'id', $idCount ++ );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
627 1
			$objWriter->writeAttribute ( 'fill', 'hold' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
628
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:stCondLst
629 1
			$objWriter->startElement ( 'p:stCondLst' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
630
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:stCondLst/p:cond
631 1
			$objWriter->startElement ( 'p:cond' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
632 1
			$objWriter->writeAttribute ( 'delay', '0' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
633 1
			$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
634
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn\##p:stCondLst
635 1
			$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
636
			
637
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst
638 1
			$objWriter->startElement ( 'p:childTnLst' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
639
			
640
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par
641 1
			$objWriter->startElement ( 'p:par' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
642
			
643
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn
644 1
			$objWriter->startElement ( 'p:cTn' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
645 1
			$objWriter->writeAttribute ( 'id', $idCount ++ );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
646 1
			$objWriter->writeAttribute ( 'fill', 'hold' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
647
			
648
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:stCondLst
649 1
			$objWriter->startElement ( 'p:stCondLst' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
650
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:stCondLst/p:cond
651 1
			$objWriter->startElement ( 'p:cond' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
652 1
			$objWriter->writeAttribute ( 'delay', '0' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
653 1
			$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
654
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:stCondLst
655
			
656 1
			$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
657
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn
658
			
659 1
			$objWriter->startElement ( 'p:childTnLst' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
660
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst
661 1
			$objWriter->startElement ( 'p:par' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
662
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par
663
			
664 1
			$objWriter->startElement ( 'p:cTn' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
665
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn
666 1
			$objWriter->writeAttribute ( 'id', $idCount ++ );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
667 1
			$objWriter->writeAttribute ( 'presetID', '2' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
668 1
			$objWriter->writeAttribute ( 'presetClass', 'mediacall' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
669 1
			$objWriter->writeAttribute ( 'presetSubtype', '0' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
670 1
			$objWriter->writeAttribute ( 'fill', 'hold' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
671 1
			$objWriter->writeAttribute ( 'nodeType', 'clickEffect' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
672
			
673 1
			$objWriter->startElement ( 'p:stCondLst' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
674
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:stCondLst
675 1
			$objWriter->startElement ( 'p:cond' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
676
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:stCondLst/p:cond
677 1
			$objWriter->writeAttribute ( 'delay', '0' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
678 1
			$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
679
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:stCondLst
680
			
681 1
			$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
682
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn
683
			
684 1
			$objWriter->startElement ( 'p:childTnLst' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
685
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst
686
			
687 1
			$objWriter->startElement ( 'p:cmd' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
688
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:cmd
689 1
			$objWriter->writeAttribute ( 'type', 'call' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
690 1
			$objWriter->writeAttribute ( 'cmd', 'togglePause' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
691
			
692 1
			$objWriter->startElement ( 'p:cBhvr' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
693
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:cmd/p:cBhvr
694
			
695 1
			$objWriter->startElement ( 'p:cTn' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
696
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:cmd/p:cBhvr/p:cTn
697 1
			$objWriter->writeAttribute ( 'id', $idCount ++ );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
698 1
			$objWriter->writeAttribute ( 'dur', '1' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
699 1
			$objWriter->writeAttribute ( 'fill', 'hold' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
700 1
			$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
701
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:cmd/p:cBhvr
702
			
703 1
			$objWriter->startElement ( 'p:tgtEl' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
704
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:cmd/p:cBhvr/p:tgtEl
705 1
			$objWriter->startElement ( 'p:spTgt' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
706
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:cmd/p:cBhvr/p:tgtEl/p:spTgt
707 1
			$objWriter->writeAttribute ( 'spid', $shapeId );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
708 1
			$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
709
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:cmd/p:cBhvr/p:tgtEl
710 1
			$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
711
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:cmd/p:cBhvr
712
			
713 1
			$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
714
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:cmd
715
			
716 1
			$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
717
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst
718
			
719 1
			$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
720
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn
721
			
722 1
			$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
723
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par
724
			
725 1
			$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
726
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst
727
			
728 1
			$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
729
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn
730
			
731 1
			$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
732
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par
733
			
734 1
			$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
735
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst
736
			
737 1
			$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
738
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn
739
			
740 1
			$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
741
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par
742
			
743 1
			$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
744
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst
745
			
746 1
			$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
747
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn
748
			
749 1
			$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
750
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par
751
			
752 1
			$objWriter->startElement ( 'p:nextCondLst' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
753
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:nextCondLst
754
			
755 1
			$objWriter->startElement ( 'p:cond' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
756
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:nextCondLst/p:cond
757 1
			$objWriter->writeAttribute ( 'evt', 'onClick' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
758 1
			$objWriter->writeAttribute ( 'delay', '0' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
759
			
760 1
			$objWriter->startElement ( 'p:tgtEl' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
761
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:nextCondLst/p:cond/p:tgtEl
762 1
			$objWriter->startElement ( 'p:spTgt' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
763
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:nextCondLst/p:cond/p:tgtEl/p:spTgt
764 1
			$objWriter->writeAttribute ( 'spid', $shapeId );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
765 1
			$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
766
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:nextCondLst/p:cond/p:tgtEl
767 1
			$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
768
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:nextCondLst/p:cond
769
			
770 1
			$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
771
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:nextCondLst
772
			
773 1
			$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
774
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq
775
			
776 1
			$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
777
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst
778
			
779 1
			if ($shape instanceof Video) {
780
				$objWriter->startElement ( 'p:video' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
781
				// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:video
782 1
			} elseif ($shape instanceof Audio) {
0 ignored issues
show
Bug introduced by
The variable $shape does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
783
				$objWriter->startElement ( 'p:audio' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
784
				// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:audio
785
			}
786
			
787 1
			$objWriter->startElement ( 'p:cMediaNode' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
788
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:video/p:cMediaNode
789 1
			$objWriter->writeAttribute ( 'vol', 80000 );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
790
			
791 1
			$objWriter->startElement ( 'p:cTn' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
792
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:video/p:cMediaNode/p:cTn
793 1
			$objWriter->writeAttribute ( 'id', $idCount ++ );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
794 1
			$objWriter->writeAttribute ( 'fill', 'hold' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
795 1
			$objWriter->writeAttribute ( 'display', '0' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
796
			
797 1
			$objWriter->startElement ( 'p:stCondLst' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
798
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:video/p:cMediaNode/p:cTn/p:stCondLst
799
			
800 1
			$objWriter->startElement ( 'p:cond' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
801
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:video/p:cMediaNode/p:cTn/p:stCondLst/p:cond
802 1
			$objWriter->writeAttribute ( 'delay', 'indefinite' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
803 1
			$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
804
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:video/p:cMediaNode/p:cTn/p:stCondLst
805
			
806 1
			$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
807
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:video/p:cMediaNode/p:cTn
808
			
809 1
			$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
810
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:video/p:cMediaNode
811
			
812 1
			$objWriter->startElement ( 'p:tgtEl' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
813
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:video/p:cMediaNode/p:tgtEl
814 1
			$objWriter->startElement ( 'p:spTgt' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
815
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:video/p:cMediaNode/p:tgtEl/p:spTgt
816 1
			$objWriter->writeAttribute ( 'spid', $shapeId );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
817 1
			$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
818
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:video/p:cMediaNode/p:tgtEl
819 1
			$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
820
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:video/p:cMediaNode
821
			
822 1
			$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
823
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:video
824
			
825 1
			$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
826
			// p:timing/p:tnLst/p:par/p:cTn/p:childTnLst
827
		}
828 1
		$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
829
		// p:timing/p:tnLst/p:par/p:cTn
830
		
831 1
		$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
832
		// p:timing/p:tnLst/p:par
833
		
834 1
		$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
835
		// p:timing/p:tnLst
836
		
837 1
		$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
838
		// p:timing
839
		
840 1
		$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
841
		//
842 1
	}
843
	
844
	/**
845
	 * Write pic
846
	 *
847
	 * @param \PhpOffice\Common\XMLWriter $objWriter
848
	 *        	XML Writer
849
	 * @param \PhpOffice\PhpPresentation\Shape\Drawing\AbstractDrawingAdapter $shape        	
850
	 * @param int $shapeId        	
851
	 * @throws \Exception
852
	 */
853
	protected function writeShapeDrawing(XMLWriter $objWriter, ShapeDrawing\AbstractDrawingAdapter $shape, $shapeId) {
854
		// p:pic
855
		$objWriter->startElement ( 'p:pic' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
856
		
857
		// p:nvPicPr
858
		$objWriter->startElement ( 'p:nvPicPr' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
859
		
860
		// p:cNvPr
861
		$objWriter->startElement ( 'p:cNvPr' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
862
		$objWriter->writeAttribute ( 'id', $shapeId );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
863
		$objWriter->writeAttribute ( 'name', $shape->getName () );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
864
		$objWriter->writeAttribute ( 'descr', $shape->getDescription () );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
865
		
866
		// a:hlinkClick
867
		if ($shape->hasHyperlink ()) {
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
868
			$this->writeHyperlink ( $objWriter, $shape );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
869
		}
870
		
871
		$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
872
		
873
		// p:cNvPicPr
874
		$objWriter->startElement ( 'p:cNvPicPr' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
875
		
876
		// a:picLocks
877
		$objWriter->startElement ( 'a:picLocks' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
878
		$objWriter->writeAttribute ( 'noChangeAspect', '1' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
879
		$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
880
		
881
		$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
882
		
883
		// p:nvPr
884
		$objWriter->startElement ( 'p:nvPr' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
885
		// PlaceHolder
886
		if ($shape->isPlaceholder ()) {
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
887
			$objWriter->startElement ( 'p:ph' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
888
			$objWriter->writeAttribute ( 'type', $shape->getPlaceholder ()->getType () );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
889
			$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
890
		}
891
		/**
892
		 *
893
		 * @link : https://github.com/stefslon/exportToPPTX/blob/master/exportToPPTX.m#L2128
894
		 */
895
		if ($shape instanceof Video) {
896
			// p:nvPr > a:videoFile
897
			$objWriter->startElement ( 'a:videoFile' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
898
			$objWriter->writeAttribute ( 'r:link', $shape->relationId );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
899
			$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
900
			// p:nvPr > p:extLst
901
			$objWriter->startElement ( 'p:extLst' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
902
			// p:nvPr > p:extLst > p:ext
903
			$objWriter->startElement ( 'p:ext' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
904
			$objWriter->writeAttribute ( 'uri', '{DAA4B4D4-6D71-4841-9C94-3DE7FCFB9230}' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
905
			// p:nvPr > p:extLst > p:ext > p14:media
906
			$objWriter->startElement ( 'p14:media' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
907
			$objWriter->writeAttribute ( 'r:embed', ($shape->relationId + 1) );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
908
			$objWriter->writeAttribute ( 'xmlns:p14', 'http://schemas.microsoft.com/office/powerpoint/2010/main' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
909
			// p:nvPr > p:extLst > p:ext > ##p14:media
910
			$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
911
			// p:nvPr > p:extLst > ##p:ext
912
			$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
913
			// p:nvPr > ##p:extLst
914
			$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
915
		}
916
		// ##p:nvPr
917
		$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
918
		$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
919
		
920
		// p:blipFill
921
		$objWriter->startElement ( 'p:blipFill' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
922
		
923
		// a:blip
924
		$objWriter->startElement ( 'a:blip' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
925
		$objWriter->writeAttribute ( 'r:embed', $shape->relationId );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
926
		$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
927
		
928
		// a:stretch
929
		$objWriter->startElement ( 'a:stretch' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
930
		$objWriter->writeElement ( 'a:fillRect' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
931
		$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
932
		
933
		$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
934
		
935
		// p:spPr
936
		$objWriter->startElement ( 'p:spPr' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
937
		// a:xfrm
938
		$objWriter->startElement ( 'a:xfrm' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
939
		$objWriter->writeAttributeIf ( $shape->getRotation () != 0, 'rot', CommonDrawing::degreesToAngle ( $shape->getRotation () ) );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
940
		
941
		// a:off
942
		$objWriter->startElement ( 'a:off' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
943
		$objWriter->writeAttribute ( 'x', CommonDrawing::pixelsToEmu ( $shape->getOffsetX () ) );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
944
		$objWriter->writeAttribute ( 'y', CommonDrawing::pixelsToEmu ( $shape->getOffsetY () ) );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
945
		$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
946
		
947
		// a:ext
948
		$objWriter->startElement ( 'a:ext' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
949
		$objWriter->writeAttribute ( 'cx', CommonDrawing::pixelsToEmu ( $shape->getWidth () ) );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
950
		$objWriter->writeAttribute ( 'cy', CommonDrawing::pixelsToEmu ( $shape->getHeight () ) );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
951
		$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
952
		
953
		$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
954
		
955
		// a:prstGeom
956
		$objWriter->startElement ( 'a:prstGeom' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
957
		$objWriter->writeAttribute ( 'prst', 'rect' );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
958
		// // a:prstGeom/a:avLst
959
		$objWriter->writeElement ( 'a:avLst', null );
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
960
		// ##a:prstGeom
961
		$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
962
		
963
		$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
964
		
965
		$objWriter->endElement ();
0 ignored issues
show
Coding Style introduced by
Space before opening parenthesis of function call prohibited
Loading history...
966
	}
967
}
968