From 91153a353292957d8506934549c49074f51059d5 Mon Sep 17 00:00:00 2001 From: netkas Date: Thu, 6 Mar 2025 15:14:27 -0500 Subject: [PATCH] Add factory method to create InvalidRpcArgumentException from InvalidArgumentException --- .../Standard/InvalidRpcArgumentException.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Socialbox/Exceptions/Standard/InvalidRpcArgumentException.php b/src/Socialbox/Exceptions/Standard/InvalidRpcArgumentException.php index 9c2c30a..5a1f101 100644 --- a/src/Socialbox/Exceptions/Standard/InvalidRpcArgumentException.php +++ b/src/Socialbox/Exceptions/Standard/InvalidRpcArgumentException.php @@ -48,4 +48,15 @@ parent::__construct(sprintf('Invalid parameter %s: %s', $parameterName, $reason), StandardError::RPC_INVALID_ARGUMENTS); } + + /** + * Creates an instance of InvalidRpcArgumentException from an InvalidArgumentException + * + * @param InvalidArgumentException $e The exception to create the instance from + * @return InvalidRpcArgumentException The instance created from the exception + */ + public static function fromInvalidArgumentException(InvalidArgumentException $e): InvalidRpcArgumentException + { + return new InvalidRpcArgumentException(null, $e); + } } \ No newline at end of file