| Conditions | 1 |
| Paths | 1 |
| Total Lines | 61 |
| Code Lines | 31 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 8 | public function render() |
||
| 9 | { |
||
| 10 | // Create XML writer |
||
| 11 | $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY); |
||
| 12 | |||
| 13 | // XML header |
||
| 14 | $objWriter->startDocument('1.0', 'UTF-8', 'yes'); |
||
| 15 | |||
| 16 | // p:viewPr |
||
| 17 | $objWriter->startElement('p:viewPr'); |
||
| 18 | $objWriter->writeAttribute('xmlns:a', 'http://schemas.openxmlformats.org/drawingml/2006/main'); |
||
| 19 | $objWriter->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships'); |
||
| 20 | $objWriter->writeAttribute('xmlns:p', 'http://schemas.openxmlformats.org/presentationml/2006/main'); |
||
| 21 | $objWriter->writeAttribute('showComments', '0'); |
||
| 22 | |||
| 23 | // p:viewPr > p:slideViewPr |
||
| 24 | $objWriter->startElement('p:slideViewPr'); |
||
| 25 | |||
| 26 | // p:viewPr > p:slideViewPr > p:cSldViewPr |
||
| 27 | $objWriter->startElement('p:cSldViewPr'); |
||
| 28 | |||
| 29 | // p:viewPr > p:slideViewPr > p:cSldViewPr > p:cViewPr |
||
| 30 | $objWriter->startElement('p:cViewPr'); |
||
| 31 | |||
| 32 | // p:viewPr > p:slideViewPr > p:cSldViewPr > p:cViewPr > p:scale |
||
| 33 | $objWriter->startElement('p:scale'); |
||
| 34 | |||
| 35 | $objWriter->startElement('a:sx'); |
||
| 36 | $objWriter->writeAttribute('d', '100'); |
||
| 37 | $objWriter->writeAttribute('n', (int)($this->getPresentation()->getPresentationProperties()->getZoom() * 100)); |
||
| 38 | $objWriter->endElement(); |
||
| 39 | |||
| 40 | $objWriter->startElement('a:sy'); |
||
| 41 | $objWriter->writeAttribute('d', '100'); |
||
| 42 | $objWriter->writeAttribute('n', (int)($this->getPresentation()->getPresentationProperties()->getZoom() * 100)); |
||
| 43 | $objWriter->endElement(); |
||
| 44 | |||
| 45 | // > // p:viewPr > p:slideViewPr > p:cSldViewPr > p:cViewPr > p:scale |
||
| 46 | $objWriter->endElement(); |
||
| 47 | |||
| 48 | $objWriter->startElement('p:origin'); |
||
| 49 | $objWriter->writeAttribute('x', '0'); |
||
| 50 | $objWriter->writeAttribute('y', '0'); |
||
| 51 | $objWriter->endElement(); |
||
| 52 | |||
| 53 | // > // p:viewPr > p:slideViewPr > p:cSldViewPr > p:cViewPr |
||
| 54 | $objWriter->endElement(); |
||
| 55 | |||
| 56 | // > // p:viewPr > p:slideViewPr > p:cSldViewPr |
||
| 57 | $objWriter->endElement(); |
||
| 58 | |||
| 59 | // > // p:viewPr > p:slideViewPr |
||
| 60 | $objWriter->endElement(); |
||
| 61 | |||
| 62 | // > // p:viewPr |
||
| 63 | $objWriter->endElement(); |
||
| 64 | |||
| 65 | $this->getZip()->addFromString('ppt/viewProps.xml', $objWriter->getData()); |
||
| 66 | |||
| 67 | return $this->getZip(); |
||
| 68 | } |
||
| 69 | } |
||
| 70 |