Skip to content

Commit 6a85e5d

Browse files
authored
Merge pull request #106 from AlexanderPoellmann/main
Fix: allow macro calls on the ReceiptPrinter class
2 parents da10a28 + 75a3c33 commit 6a85e5d

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/Receipts/ReceiptPrinter.php

+7-5
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@
4242
class ReceiptPrinter
4343
{
4444
use Conditionable;
45-
use Macroable;
45+
use Macroable {
46+
Macroable::__call as __macroCall;
47+
}
4648

4749
protected DummyPrintConnector $connector;
4850

@@ -68,15 +70,15 @@ public function __toString(): string
6870
return $this->connector->getData();
6971
}
7072

71-
public function __call($name, $arguments)
73+
public function __call($method, $parameters)
7274
{
73-
if (method_exists($this->printer, $name)) {
74-
$this->printer->{$name}(...$arguments);
75+
if (method_exists($this->printer, $method)) {
76+
$this->printer->{$method}(...$parameters);
7577

7678
return $this;
7779
}
7880

79-
throw new InvalidArgumentException("Method [{$name}] not found on receipt printer object.");
81+
return $this->__macroCall($method, $parameters);
8082
}
8183

8284
public function centerAlign(): self

0 commit comments

Comments
 (0)