Skip to content

Commit e51c2cb

Browse files
author
Phil Wilkinson
committed
PHPCS & Static analysis fixes
1 parent 70ace94 commit e51c2cb

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

src/PhpPresentation/Reader/ODPresentation.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,8 +653,13 @@ protected function loadShapeMedia(DOMElement $oNodeFrame): void
653653
}
654654

655655
$mediaFile = null;
656+
$filePath = null;
656657
if ($oNodePlugin->hasAttribute('xlink:href')) {
657658
$filePath = $oNodePlugin->getAttribute('xlink:href');
659+
if (!$filePath) {
660+
return;
661+
}
662+
658663
$filePathParts = explode('/', $filePath);
659664
if (!$filePathParts || $filePathParts[0] !== 'Media') {
660665
return;

src/PhpPresentation/Reader/PowerPoint2007.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -868,7 +868,7 @@ protected function loadShapeDrawing(XMLReader $document, DOMElement $node, Abstr
868868
$oSlide->addShape($oShape);
869869
}
870870

871-
protected function loadShapeDrawingEmbed(DOMElement $oElement, string $fileRels, AbstractDrawingAdapter $oShape): AbstractDrawingAdapter
871+
protected function loadShapeDrawingEmbed(DOMElement $oElement, string $fileRels, Media $oShape): Media
872872
{
873873
if (!$oElement->hasAttribute('r:embed')) {
874874
return $oShape;
@@ -900,10 +900,11 @@ protected function loadShapeDrawingEmbed(DOMElement $oElement, string $fileRels,
900900
->setName($fileName)
901901
->setFileName($fileName)
902902
->setPath($tmpEmbed, false);
903+
903904
return $oShape;
904905
}
905906

906-
protected function loadShapeDrawingImage(XMLReader $document, DOMElement $node, string $fileRels, AbstractDrawingAdapter $oShape)
907+
protected function loadShapeDrawingImage(XMLReader $document, DOMElement $node, string $fileRels, AbstractDrawingAdapter $oShape): AbstractDrawingAdapter
907908
{
908909
$oElement = $document->getElement('p:blipFill/a:blip', $node);
909910
if (!($oElement instanceof DOMElement)) {

src/PhpPresentation/Shape/Drawing/File.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,10 @@ public function getFileName(): string
7979
* @param string $fileName
8080
* @return File
8181
*/
82-
public function setFileName(string $fileName): File
82+
public function setFileName(string $fileName): self
8383
{
8484
$this->fileName = $fileName;
85+
8586
return $this;
8687
}
8788

0 commit comments

Comments
 (0)