Completed
Pull Request — develop (#207)
by Franck
06:53
created

PptMedia::render()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 3

Importance

Changes 5
Bugs 1 Features 0
Metric Value
c 5
b 1
f 0
dl 0
loc 12
ccs 7
cts 7
cp 1
rs 9.4285
cc 3
eloc 7
nc 3
nop 0
crap 3
1
<?php
2
3
namespace PhpOffice\PhpPresentation\Writer\PowerPoint2007;
4
5
use PhpOffice\PhpPresentation\Shape\Drawing;
6
7
class PptMedia extends AbstractDecoratorWriter
8
{
9
    /**
10
     * @return \PhpOffice\Common\Adapter\Zip\ZipInterface
11
     */
12 94
    public function render()
13
    {
14 94
        for ($i = 0; $i < $this->getDrawingHashTable()->count(); ++$i) {
15 32
            $shape = $this->getDrawingHashTable()->getByIndex($i);
16 32
            if (!$shape instanceof Drawing\AbstractDrawingAdapter) {
17 24
                continue;
18
            }
19 8
            $this->getZip()->addFromString('ppt/media/' . $shape->getIndexedFilename(), $shape->getContents());
20
        }
21
22 94
        return $this->getZip();
23
    }
24
}
25