From f5a313177fd7df36ccb48d821c76da2186924361 Mon Sep 17 00:00:00 2001 From: Shu Chen Date: Mon, 16 Dec 2024 16:21:02 +0100 Subject: [PATCH] Return null when ask for specific parameter in response --- src/Transaction/Response/TransactionResponse.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Transaction/Response/TransactionResponse.php b/src/Transaction/Response/TransactionResponse.php index c6b9bbf..0c41959 100644 --- a/src/Transaction/Response/TransactionResponse.php +++ b/src/Transaction/Response/TransactionResponse.php @@ -105,9 +105,14 @@ public function isValidationFailure(): bool */ public function data(?string $key = null) { - if ($key && isset($this->data[$key])) + if ($key) { - return $this->data[$key]; + if (isset($this->data[$key])) + { + return $this->data[$key]; + } + + return null; } return $this->data;