From 5e602443fc583cff73c18702e281d2e6c2916c90 Mon Sep 17 00:00:00 2001 From: Ariful islam Date: Sat, 10 Jul 2021 12:01:07 +0600 Subject: [PATCH] changes --- src/Helper/Helper.php | 6 ++++++ src/Sender.php | 36 +++++++++++++++++++++++------------- 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/src/Helper/Helper.php b/src/Helper/Helper.php index b1232df..8a2afd6 100644 --- a/src/Helper/Helper.php +++ b/src/Helper/Helper.php @@ -4,6 +4,12 @@ class Helper { + /** + * Mobile Number Validation + * @param $number + * @return bool + * @since v1.0.12 + */ public static function numberValidation($number) { $validCheckPattern = "/^(?:\+88|01)?(?:\d{11}|\d{13})$/"; diff --git a/src/Sender.php b/src/Sender.php index f3bf84b..e677743 100644 --- a/src/Sender.php +++ b/src/Sender.php @@ -15,14 +15,28 @@ use Exception; use Xenon\LaravelBDSms\Handler\RenderException; use Xenon\LaravelBDSms\Handler\XenonException; -use Xenon\LaravelBDSms\Handler\RenderException; class Sender { + /** + * @var + */ private $provider; + /** + * @var + */ private $message; + /** + * @var + */ private $mobile; + /** + * @var + */ private $config; + /** + * @var + */ private $method; /** @@ -41,15 +55,11 @@ public function setMethod($method): void $this->method = $method; } - private static $instance = null; - /** - * The Singleton's constructor should always be private to prevent direct - * construction calls with the `new` operator. + * @var null */ - protected function __construct() - { - } + private static $instance = null; + /** * This is the static method that controls the access to the singleton @@ -91,8 +101,8 @@ public function setConfig($config): Sender throw new XenonException('config must be an array'); } $this->config = $config; - } catch (XenonException $e) { - $e->showException(); + } catch (RenderException $e) { + return $e->getMessage(); } return $this; @@ -108,8 +118,8 @@ public function send() $this->provider->errorException(); return $this->provider->sendRequest(); - } catch (XenonException $exception) { - $exception->showException(); + } catch (RenderException $exception) { + return $exception->getMessage(); } } @@ -164,7 +174,7 @@ public function getProvider() * @return Sender * @throws RenderException */ - public function setProvider($ProviderClass) + public function setProvider($ProviderClass): Sender { try { if (!class_exists($ProviderClass)) {