Completed
Pull Request — develop (#207)
by Franck
16:14 queued 07:46
created

PptMedia::render()   A

Complexity

Conditions 4
Paths 3

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 4

Importance

Changes 4
Bugs 1 Features 0
Metric Value
c 4
b 1
f 0
dl 0
loc 12
ccs 9
cts 9
cp 1
rs 9.2
cc 4
eloc 7
nc 3
nop 0
crap 4
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
    public function render()
13 94
    {
14
        for ($i = 0; $i < $this->getDrawingHashTable()->count(); ++$i) {
15 94
            $shape = $this->getDrawingHashTable()->getByIndex($i);
16 32
            if (!$shape instanceof Drawing\AbstractDrawingAdapter && !$shape instanceof Media) {
0 ignored issues
show
Bug introduced by
The class PhpOffice\PhpPresentatio...er\PowerPoint2007\Media does not exist. Did you forget a USE statement, or did you not list all dependencies?

This error could be the result of:

1. Missing dependencies

PHP Analyzer uses your composer.json file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects the composer.json to be in the root folder of your repository.

Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the require or require-dev section?

2. Missing use statement

PHP does not complain about undefined classes in ìnstanceof checks. For example, the following PHP code will work perfectly fine:

if ($x instanceof DoesNotExist) {
    // Do something.
}

If you have not tested against this specific condition, such errors might go unnoticed.

Loading history...
17 32
                continue;
18 7
            }
19 7
            $this->getZip()->addFromString('ppt/media/' . $shape->getIndexedFilename(), $shape->getContents());
20 1
        }
21 1
22
        return $this->getZip();
23 1
    }
24
}
25