From 6fe3b1306e21b744f93dde931342198db91ad596 Mon Sep 17 00:00:00 2001 From: HorstOeko Date: Mon, 9 Oct 2023 05:50:54 +0200 Subject: [PATCH] For more clarity, internal variables have been renamed --- src/ZugferdDocumentPdfReader.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ZugferdDocumentPdfReader.php b/src/ZugferdDocumentPdfReader.php index 5b554f7a..4379e7a4 100644 --- a/src/ZugferdDocumentPdfReader.php +++ b/src/ZugferdDocumentPdfReader.php @@ -48,7 +48,7 @@ public static function readAndGuessFromFile(string $pdfFilename): ?ZugferdDocume $pdfParser = new PdfParser(); $pdfParsed = $pdfParser->parseFile($pdfFilename); - $filespec = $pdfParsed->getObjectsByType('Filespec'); + $filespecs = $pdfParsed->getObjectsByType('Filespec'); $attachmentFound = false; $attachmentIndex = 0; @@ -56,9 +56,9 @@ public static function readAndGuessFromFile(string $pdfFilename): ?ZugferdDocume $returnValue = null; try { - foreach ($filespec as $spec) { - $specDetails = $spec->getDetails(); - if (in_array($specDetails['F'], static::ATTACHMENT_FILEAMES)) { + foreach ($filespecs as $filespec) { + $filespecDetails = $filespec->getDetails(); + if (in_array($filespecDetails['F'], static::ATTACHMENT_FILEAMES)) { $attachmentFound = true; break; } @@ -70,9 +70,9 @@ public static function readAndGuessFromFile(string $pdfFilename): ?ZugferdDocume * @var array<\Smalot\PdfParser\PDFObject> */ $embeddedFiles = $pdfParsed->getObjectsByType('EmbeddedFile'); - foreach ($embeddedFiles as $embedFile) { + foreach ($embeddedFiles as $embeddedFile) { if ($attachmentIndex == $embeddedFileIndex) { - $returnValue = ZugferdDocumentReader::readAndGuessFromContent($embedFile->getContent()); + $returnValue = ZugferdDocumentReader::readAndGuessFromContent($embeddedFile->getContent()); break; } $embeddedFileIndex++;