Skip to content

Commit

Permalink
For more clarity, internal variables have been renamed
Browse files Browse the repository at this point in the history
  • Loading branch information
HorstOeko committed Oct 9, 2023
1 parent a005202 commit 6fe3b13
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/ZugferdDocumentPdfReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,17 @@ 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;
$embeddedFileIndex = 0;
$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;
}
Expand All @@ -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++;
Expand Down

0 comments on commit 6fe3b13

Please sign in to comment.