| Conditions | 5 |
| Paths | 5 |
| Total Lines | 31 |
| Code Lines | 23 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 21 |
| CRAP Score | 5.0023 |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 13 | 75 | public function render() |
|
| 14 | { |
||
| 15 | 75 | for ($i = 0; $i < $this->getDrawingHashTable()->count(); ++$i) { |
|
| 16 | 26 | $shape = $this->getDrawingHashTable()->getByIndex($i); |
|
| 17 | 26 | if ($shape instanceof Drawing) { |
|
| 18 | 5 | $imagePath = $shape->getPath(); |
|
| 19 | 5 | if (strpos($imagePath, 'zip://') !== false) { |
|
| 20 | 1 | $imagePath = substr($imagePath, 6); |
|
| 21 | 1 | $imagePathSplitted = explode('#', $imagePath); |
|
| 22 | |||
| 23 | 1 | $imageZip = new \ZipArchive(); |
|
| 24 | 1 | $imageZip->open($imagePathSplitted[0]); |
|
| 25 | 1 | $imageContents = $imageZip->getFromName($imagePathSplitted[1]); |
|
| 26 | 1 | $imageZip->close(); |
|
| 27 | 1 | unset($imageZip); |
|
| 28 | } else { |
||
| 29 | 4 | $imageContents = file_get_contents($imagePath); |
|
| 30 | } |
||
| 31 | 5 | $this->getZip()->addFromString('ppt/media/' . str_replace(' ', '_', $shape->getIndexedFilename()), $imageContents); |
|
| 32 | } elseif ($shape instanceof MemoryDrawing) { |
||
| 33 | 1 | ob_start(); |
|
| 34 | 1 | call_user_func($shape->getRenderingFunction(), $shape->getImageResource()); |
|
| 35 | 1 | $imageContents = ob_get_contents(); |
|
| 36 | 1 | ob_end_clean(); |
|
| 37 | |||
| 38 | 1 | $this->getZip()->addFromString('ppt/media/' . str_replace(' ', '_', $shape->getIndexedFilename()), $imageContents); |
|
| 39 | } |
||
| 40 | } |
||
| 41 | |||
| 42 | 75 | return $this->getZip(); |
|
| 43 | } |
||
| 44 | } |
||
| 45 |