Completed
Pull Request — develop (#565)
by
unknown
07:15
created

PptMedia::render()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 3

Importance

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