| Conditions | 2 |
| Paths | 2 |
| Total Lines | 60 |
| 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 | $presentationPpts = $this->oPresentation->getPresentationProperties(); |
||
| 11 | |||
| 12 | // Create XML writer |
||
| 13 | $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY); |
||
| 14 | |||
| 15 | // XML header |
||
| 16 | $objWriter->startDocument('1.0', 'UTF-8', 'yes'); |
||
| 17 | |||
| 18 | // p:presentationPr |
||
| 19 | $objWriter->startElement('p:presentationPr'); |
||
| 20 | $objWriter->writeAttribute('xmlns:a', 'http://schemas.openxmlformats.org/drawingml/2006/main'); |
||
| 21 | $objWriter->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships'); |
||
| 22 | $objWriter->writeAttribute('xmlns:p', 'http://schemas.openxmlformats.org/presentationml/2006/main'); |
||
| 23 | |||
| 24 | // p:presentationPr > p:showPr |
||
| 25 | if ($presentationPpts->isLoopContinuouslyUntilEsc()) { |
||
| 26 | $objWriter->startElement('p:showPr'); |
||
| 27 | $objWriter->writeAttribute('loop', '1'); |
||
| 28 | $objWriter->endElement(); |
||
| 29 | } |
||
| 30 | |||
| 31 | // p:extLst |
||
| 32 | $objWriter->startElement('p:extLst'); |
||
| 33 | |||
| 34 | // p:ext |
||
| 35 | $objWriter->startElement('p:ext'); |
||
| 36 | $objWriter->writeAttribute('uri', '{E76CE94A-603C-4142-B9EB-6D1370010A27}'); |
||
| 37 | |||
| 38 | // p14:discardImageEditData |
||
| 39 | $objWriter->startElement('p14:discardImageEditData'); |
||
| 40 | $objWriter->writeAttribute('xmlns:p14', 'http://schemas.microsoft.com/office/powerpoint/2010/main'); |
||
| 41 | $objWriter->writeAttribute('val', '0'); |
||
| 42 | $objWriter->endElement(); |
||
| 43 | |||
| 44 | // > p:ext |
||
| 45 | $objWriter->endElement(); |
||
| 46 | |||
| 47 | // p:ext |
||
| 48 | $objWriter->startElement('p:ext'); |
||
| 49 | $objWriter->writeAttribute('uri', '{D31A062A-798A-4329-ABDD-BBA856620510}'); |
||
| 50 | |||
| 51 | // p14:defaultImageDpi |
||
| 52 | $objWriter->startElement('p14:defaultImageDpi'); |
||
| 53 | $objWriter->writeAttribute('xmlns:p14', 'http://schemas.microsoft.com/office/powerpoint/2010/main'); |
||
| 54 | $objWriter->writeAttribute('val', '220'); |
||
| 55 | $objWriter->endElement(); |
||
| 56 | |||
| 57 | // > p:ext |
||
| 58 | $objWriter->endElement(); |
||
| 59 | // > p:extLst |
||
| 60 | $objWriter->endElement(); |
||
| 61 | // > p:presentationPr |
||
| 62 | $objWriter->endElement(); |
||
| 63 | |||
| 64 | $this->getZip()->addFromString('ppt/presProps.xml', $objWriter->getData()); |
||
| 65 | |||
| 66 | return $this->getZip(); |
||
| 67 | } |
||
| 68 | } |
||
| 69 |