Skip to content
This repository was archived by the owner on Apr 29, 2025. It is now read-only.

Commit 1960b11

Browse files
committed
🐛 Fix parsing receipts without heading
1 parent 4376943 commit 1960b11

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Receipt.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,12 @@ public function getShop(): Shop {
5656
$rawPos = explode("\n", $this->raw_receipt);
5757
$address_part = array_slice($rawPos, 0, 5);
5858
preg_match('/(\d{5}) (.*)/', implode("\n", $address_part), $zip_city);
59-
return new Shop(trim($address_part[0]), trim($address_part[1]), trim($zip_city[1]), trim($zip_city[2]));
59+
return new Shop(
60+
trim($address_part[0] ?? null),
61+
trim($address_part[1] ?? null),
62+
trim($zip_city[1] ?? null),
63+
trim($zip_city[2] ?? null),
64+
);
6065
}
6166

6267
/**

0 commit comments

Comments
 (0)