@@ -22,7 +22,7 @@ discard block  | 
                                                    ||
| 22 | 22 | */  | 
                                                        
| 23 | 23 | public function loadEnv()  | 
                                                        
| 24 | 24 |       { | 
                                                        
| 25 | -         if (! getenv('APP_ENV')) { | 
                                                        |
| 25 | +         if (!getenv('APP_ENV')) { | 
                                                        |
| 26 | 26 | $dotenv = new Dotenv(__DIR__.'/../');  | 
                                                        
| 27 | 27 | $dotenv->load();  | 
                                                        
| 28 | 28 | }  | 
                                                        
@@ -114,7 +114,7 @@ discard block  | 
                                                    ||
| 114 | 114 | */  | 
                                                        
| 115 | 115 | public function correctPayload()  | 
                                                        
| 116 | 116 |       { | 
                                                        
| 117 | - $message = "I LOVE YOU, BABY";  | 
                                                        |
| 117 | + $message = "I LOVE YOU, BABY";  | 
                                                        |
| 118 | 118 | |
| 119 | 119 | return [  | 
                                                        
| 120 | 120 | 'to' => '8038142771',  | 
                                                        
@@ -18,58 +18,58 @@ discard block  | 
                                                    ||
| 18 | 18 |  trait Helper { | 
                                                        
| 19 | 19 | |
| 20 | 20 | /**  | 
                                                        
| 21 | - * Load Dotenv to grant getenv() access to environment variables in .env file.  | 
                                                        |
| 22 | - */  | 
                                                        |
| 23 | - public function loadEnv()  | 
                                                        |
| 24 | -     { | 
                                                        |
| 25 | -         if (! getenv('APP_ENV')) { | 
                                                        |
| 26 | - $dotenv = new Dotenv(__DIR__.'/../');  | 
                                                        |
| 27 | - $dotenv->load();  | 
                                                        |
| 28 | - }  | 
                                                        |
| 29 | - }  | 
                                                        |
| 30 | -  | 
                                                        |
| 31 | - /**  | 
                                                        |
| 32 | - * Get Valid Message ID  | 
                                                        |
| 33 | - * @return string  | 
                                                        |
| 34 | - */  | 
                                                        |
| 35 | - public function getValidMessageID()  | 
                                                        |
| 36 | -     { | 
                                                        |
| 21 | + * Load Dotenv to grant getenv() access to environment variables in .env file.  | 
                                                        |
| 22 | + */  | 
                                                        |
| 23 | + public function loadEnv()  | 
                                                        |
| 24 | +        { | 
                                                        |
| 25 | +            if (! getenv('APP_ENV')) { | 
                                                        |
| 26 | + $dotenv = new Dotenv(__DIR__.'/../');  | 
                                                        |
| 27 | + $dotenv->load();  | 
                                                        |
| 28 | + }  | 
                                                        |
| 29 | + }  | 
                                                        |
| 30 | +  | 
                                                        |
| 31 | + /**  | 
                                                        |
| 32 | + * Get Valid Message ID  | 
                                                        |
| 33 | + * @return string  | 
                                                        |
| 34 | + */  | 
                                                        |
| 35 | + public function getValidMessageID()  | 
                                                        |
| 36 | +        { | 
                                                        |
| 37 | 37 |          return getenv('VALID_MESSAGE_ID'); | 
                                                        
| 38 | - }  | 
                                                        |
| 39 | -  | 
                                                        |
| 40 | - /**  | 
                                                        |
| 41 | - * Get Valid Bulk Message ID  | 
                                                        |
| 42 | - * @return string  | 
                                                        |
| 43 | - */  | 
                                                        |
| 44 | - public function getValidBulkMessageID()  | 
                                                        |
| 45 | -      { | 
                                                        |
| 46 | -         return getenv('BULK_MESSAGE_ID'); | 
                                                        |
| 47 | - }  | 
                                                        |
| 48 | -  | 
                                                        |
| 49 | - /**  | 
                                                        |
| 50 | - * Get Invalid Message ID  | 
                                                        |
| 51 | - * @return string  | 
                                                        |
| 52 | - */  | 
                                                        |
| 53 | - public function getInvalidMessageID()  | 
                                                        |
| 54 | -     { | 
                                                        |
| 38 | + }  | 
                                                        |
| 39 | +  | 
                                                        |
| 40 | + /**  | 
                                                        |
| 41 | + * Get Valid Bulk Message ID  | 
                                                        |
| 42 | + * @return string  | 
                                                        |
| 43 | + */  | 
                                                        |
| 44 | + public function getValidBulkMessageID()  | 
                                                        |
| 45 | +        { | 
                                                        |
| 46 | +            return getenv('BULK_MESSAGE_ID'); | 
                                                        |
| 47 | + }  | 
                                                        |
| 48 | +  | 
                                                        |
| 49 | + /**  | 
                                                        |
| 50 | + * Get Invalid Message ID  | 
                                                        |
| 51 | + * @return string  | 
                                                        |
| 52 | + */  | 
                                                        |
| 53 | + public function getInvalidMessageID()  | 
                                                        |
| 54 | +        { | 
                                                        |
| 55 | 55 |          return getenv('INVALID_MESSAGE_ID'); | 
                                                        
| 56 | - }  | 
                                                        |
| 57 | -  | 
                                                        |
| 58 | - /**  | 
                                                        |
| 59 | - * Get Valid Access Token  | 
                                                        |
| 60 | - * @return string  | 
                                                        |
| 61 | - */  | 
                                                        |
| 62 | - public function getValidAccessToken()  | 
                                                        |
| 63 | -     { | 
                                                        |
| 56 | + }  | 
                                                        |
| 57 | +  | 
                                                        |
| 58 | + /**  | 
                                                        |
| 59 | + * Get Valid Access Token  | 
                                                        |
| 60 | + * @return string  | 
                                                        |
| 61 | + */  | 
                                                        |
| 62 | + public function getValidAccessToken()  | 
                                                        |
| 63 | +        { | 
                                                        |
| 64 | 64 |          return getenv('VALID_ACCESS_TOKEN'); | 
                                                        
| 65 | - }  | 
                                                        |
| 66 | -  | 
                                                        |
| 67 | - /**  | 
                                                        |
| 68 | - * Stubbed checkDeliveryStatusResponse  | 
                                                        |
| 69 | - * @return object  | 
                                                        |
| 70 | - */  | 
                                                        |
| 71 | - public function checkDeliveryStatusResponse()  | 
                                                        |
| 72 | -     { | 
                                                        |
| 65 | + }  | 
                                                        |
| 66 | +  | 
                                                        |
| 67 | + /**  | 
                                                        |
| 68 | + * Stubbed checkDeliveryStatusResponse  | 
                                                        |
| 69 | + * @return object  | 
                                                        |
| 70 | + */  | 
                                                        |
| 71 | + public function checkDeliveryStatusResponse()  | 
                                                        |
| 72 | +        { | 
                                                        |
| 73 | 73 | $response = new StdClass;  | 
                                                        
| 74 | 74 | $response->message_id = $this->getValidMessageID();  | 
                                                        
| 75 | 75 | $response->status = 'Delivered';  | 
                                                        
@@ -77,97 +77,97 @@ discard block  | 
                                                    ||
| 77 | 77 | $response->date_delivered = time();  | 
                                                        
| 78 | 78 | |
| 79 | 79 | return $response;  | 
                                                        
| 80 | - }  | 
                                                        |
| 81 | -  | 
                                                        |
| 82 | - /**  | 
                                                        |
| 83 | - * Stubbed checkBulkDeliveryStatusResponse  | 
                                                        |
| 84 | - * @return object  | 
                                                        |
| 85 | - */  | 
                                                        |
| 86 | - public function checkBulkDeliveryStatusResponse()  | 
                                                        |
| 87 | -      { | 
                                                        |
| 88 | - $response = new StdClass;  | 
                                                        |
| 89 | - $response->bulk_message_id = $this->getValidBulkMessageID();  | 
                                                        |
| 90 | - $response->status = 'Completed';  | 
                                                        |
| 91 | - $response->created = time();  | 
                                                        |
| 92 | - $response->processed = time();  | 
                                                        |
| 93 | - $response->total_numbers = 2;  | 
                                                        |
| 94 | - $response->total_unique_numbers = 2;  | 
                                                        |
| 95 | - $response->total_valid_numbers = 2;  | 
                                                        |
| 96 | - $response->total_invalid_numbers = 0;  | 
                                                        |
| 80 | + }  | 
                                                        |
| 81 | +  | 
                                                        |
| 82 | + /**  | 
                                                        |
| 83 | + * Stubbed checkBulkDeliveryStatusResponse  | 
                                                        |
| 84 | + * @return object  | 
                                                        |
| 85 | + */  | 
                                                        |
| 86 | + public function checkBulkDeliveryStatusResponse()  | 
                                                        |
| 87 | +        { | 
                                                        |
| 88 | + $response = new StdClass;  | 
                                                        |
| 89 | + $response->bulk_message_id = $this->getValidBulkMessageID();  | 
                                                        |
| 90 | + $response->status = 'Completed';  | 
                                                        |
| 91 | + $response->created = time();  | 
                                                        |
| 92 | + $response->processed = time();  | 
                                                        |
| 93 | + $response->total_numbers = 2;  | 
                                                        |
| 94 | + $response->total_unique_numbers = 2;  | 
                                                        |
| 95 | + $response->total_valid_numbers = 2;  | 
                                                        |
| 96 | + $response->total_invalid_numbers = 0;  | 
                                                        |
| 97 | 97 | |
| 98 | - return $response;  | 
                                                        |
| 99 | - }  | 
                                                        |
| 100 | -  | 
                                                        |
| 101 | - /**  | 
                                                        |
| 102 | - * Stubbed Invalid Keys Response  | 
                                                        |
| 103 | - * @return object  | 
                                                        |
| 104 | - */  | 
                                                        |
| 105 | - public function invalidKeysResponse()  | 
                                                        |
| 106 | -     { | 
                                                        |
| 98 | + return $response;  | 
                                                        |
| 99 | + }  | 
                                                        |
| 100 | +  | 
                                                        |
| 101 | + /**  | 
                                                        |
| 102 | + * Stubbed Invalid Keys Response  | 
                                                        |
| 103 | + * @return object  | 
                                                        |
| 104 | + */  | 
                                                        |
| 105 | + public function invalidKeysResponse()  | 
                                                        |
| 106 | +        { | 
                                                        |
| 107 | 107 | $response = new StdClass;  | 
                                                        
| 108 | 108 | $response->error = "Invalid API Key!";  | 
                                                        
| 109 | 109 | |
| 110 | 110 | return $response;  | 
                                                        
| 111 | - }  | 
                                                        |
| 112 | -  | 
                                                        |
| 113 | - /**  | 
                                                        |
| 114 | - * Stubbed Invalid Message ID Response  | 
                                                        |
| 115 | - * @return object  | 
                                                        |
| 116 | - */  | 
                                                        |
| 117 | - public function invalidMessageIDResponse()  | 
                                                        |
| 118 | -     { | 
                                                        |
| 111 | + }  | 
                                                        |
| 112 | +  | 
                                                        |
| 113 | + /**  | 
                                                        |
| 114 | + * Stubbed Invalid Message ID Response  | 
                                                        |
| 115 | + * @return object  | 
                                                        |
| 116 | + */  | 
                                                        |
| 117 | + public function invalidMessageIDResponse()  | 
                                                        |
| 118 | +        { | 
                                                        |
| 119 | 119 | $response = new StdClass;  | 
                                                        
| 120 | 120 | $response->invalid_message_id = "Invalid message ID";  | 
                                                        
| 121 | 121 | |
| 122 | 122 | return $response;  | 
                                                        
| 123 | - }  | 
                                                        |
| 124 | -  | 
                                                        |
| 125 | - /**  | 
                                                        |
| 126 | - * Stubbed sendSMSResponse  | 
                                                        |
| 127 | - * @return object  | 
                                                        |
| 128 | - */  | 
                                                        |
| 129 | - public function sendSMSResponse()  | 
                                                        |
| 130 | -     { | 
                                                        |
| 123 | + }  | 
                                                        |
| 124 | +  | 
                                                        |
| 125 | + /**  | 
                                                        |
| 126 | + * Stubbed sendSMSResponse  | 
                                                        |
| 127 | + * @return object  | 
                                                        |
| 128 | + */  | 
                                                        |
| 129 | + public function sendSMSResponse()  | 
                                                        |
| 130 | +        { | 
                                                        |
| 131 | 131 | $response = new StdClass;  | 
                                                        
| 132 | 132 | $response->status = 'Sent';  | 
                                                        
| 133 | 133 | $response->message_id = $this->getValidMessageID();  | 
                                                        
| 134 | 134 | $response->sms_credits_used = 1;  | 
                                                        
| 135 | 135 | |
| 136 | 136 | return $response;  | 
                                                        
| 137 | - }  | 
                                                        |
| 138 | -  | 
                                                        |
| 139 | - /**  | 
                                                        |
| 140 | - * Stubbed sendBulkSMSResponse  | 
                                                        |
| 141 | - * @return object  | 
                                                        |
| 142 | - */  | 
                                                        |
| 143 | - public function sendBulkSMSResponse()  | 
                                                        |
| 144 | -      { | 
                                                        |
| 145 | - $response = new StdClass;  | 
                                                        |
| 146 | - $response->status = 'Submitted';  | 
                                                        |
| 147 | - $response->bulk_message_id = $this->getValidBulkMessageID();  | 
                                                        |
| 148 | - $response->request_speed = 0.05;  | 
                                                        |
| 137 | + }  | 
                                                        |
| 138 | +  | 
                                                        |
| 139 | + /**  | 
                                                        |
| 140 | + * Stubbed sendBulkSMSResponse  | 
                                                        |
| 141 | + * @return object  | 
                                                        |
| 142 | + */  | 
                                                        |
| 143 | + public function sendBulkSMSResponse()  | 
                                                        |
| 144 | +        { | 
                                                        |
| 145 | + $response = new StdClass;  | 
                                                        |
| 146 | + $response->status = 'Submitted';  | 
                                                        |
| 147 | + $response->bulk_message_id = $this->getValidBulkMessageID();  | 
                                                        |
| 148 | + $response->request_speed = 0.05;  | 
                                                        |
| 149 | 149 | |
| 150 | - return $response;  | 
                                                        |
| 151 | - }  | 
                                                        |
| 152 | -  | 
                                                        |
| 153 | - /**  | 
                                                        |
| 154 | - * Stubbed checkAvailableCreditsResponse  | 
                                                        |
| 155 | - * @return object  | 
                                                        |
| 156 | - */  | 
                                                        |
| 157 | - public function checkAvailableCreditsResponse()  | 
                                                        |
| 158 | -     { | 
                                                        |
| 150 | + return $response;  | 
                                                        |
| 151 | + }  | 
                                                        |
| 152 | +  | 
                                                        |
| 153 | + /**  | 
                                                        |
| 154 | + * Stubbed checkAvailableCreditsResponse  | 
                                                        |
| 155 | + * @return object  | 
                                                        |
| 156 | + */  | 
                                                        |
| 157 | + public function checkAvailableCreditsResponse()  | 
                                                        |
| 158 | +        { | 
                                                        |
| 159 | 159 | $response = new StdClass;  | 
                                                        
| 160 | 160 | $response->sms_credits = 200;  | 
                                                        
| 161 | 161 | |
| 162 | 162 | return $response;  | 
                                                        
| 163 | - }  | 
                                                        |
| 164 | -  | 
                                                        |
| 165 | - /**  | 
                                                        |
| 166 | - * Stubbed correct Payload  | 
                                                        |
| 167 | - * @return array  | 
                                                        |
| 168 | - */  | 
                                                        |
| 169 | - public function correctPayload()  | 
                                                        |
| 170 | -     { | 
                                                        |
| 163 | + }  | 
                                                        |
| 164 | +  | 
                                                        |
| 165 | + /**  | 
                                                        |
| 166 | + * Stubbed correct Payload  | 
                                                        |
| 167 | + * @return array  | 
                                                        |
| 168 | + */  | 
                                                        |
| 169 | + public function correctPayload()  | 
                                                        |
| 170 | +        { | 
                                                        |
| 171 | 171 | $message = "I LOVE YOU, BABY";  | 
                                                        
| 172 | 172 | |
| 173 | 173 | return [  | 
                                                        
@@ -175,34 +175,34 @@ discard block  | 
                                                    ||
| 175 | 175 | 'from' => 'TEST JUSIBE',  | 
                                                        
| 176 | 176 | 'message' => $message  | 
                                                        
| 177 | 177 | ];  | 
                                                        
| 178 | - }  | 
                                                        |
| 179 | -  | 
                                                        |
| 180 | - /**  | 
                                                        |
| 181 | - * Get Invalid Access Token  | 
                                                        |
| 182 | - * @return string  | 
                                                        |
| 183 | - */  | 
                                                        |
| 184 | - public function getInvalidAccessToken()  | 
                                                        |
| 185 | -     { | 
                                                        |
| 178 | + }  | 
                                                        |
| 179 | +  | 
                                                        |
| 180 | + /**  | 
                                                        |
| 181 | + * Get Invalid Access Token  | 
                                                        |
| 182 | + * @return string  | 
                                                        |
| 183 | + */  | 
                                                        |
| 184 | + public function getInvalidAccessToken()  | 
                                                        |
| 185 | +        { | 
                                                        |
| 186 | 186 |          return getenv('INVALID_ACCESS_TOKEN'); | 
                                                        
| 187 | - }  | 
                                                        |
| 188 | -  | 
                                                        |
| 189 | - /**  | 
                                                        |
| 190 | - * Get Valid Public Key  | 
                                                        |
| 191 | - * @return string  | 
                                                        |
| 192 | - */  | 
                                                        |
| 193 | - public function getValidPublicKey()  | 
                                                        |
| 194 | -     { | 
                                                        |
| 187 | + }  | 
                                                        |
| 188 | +  | 
                                                        |
| 189 | + /**  | 
                                                        |
| 190 | + * Get Valid Public Key  | 
                                                        |
| 191 | + * @return string  | 
                                                        |
| 192 | + */  | 
                                                        |
| 193 | + public function getValidPublicKey()  | 
                                                        |
| 194 | +        { | 
                                                        |
| 195 | 195 |          return getenv('VALID_PUBLIC_KEY'); | 
                                                        
| 196 | - }  | 
                                                        |
| 197 | -  | 
                                                        |
| 198 | - /**  | 
                                                        |
| 199 | - * Get Valid Public Key  | 
                                                        |
| 200 | - * @return string  | 
                                                        |
| 201 | - */  | 
                                                        |
| 202 | - public function getInvalidPublicKey()  | 
                                                        |
| 203 | -     { | 
                                                        |
| 196 | + }  | 
                                                        |
| 197 | +  | 
                                                        |
| 198 | + /**  | 
                                                        |
| 199 | + * Get Valid Public Key  | 
                                                        |
| 200 | + * @return string  | 
                                                        |
| 201 | + */  | 
                                                        |
| 202 | + public function getInvalidPublicKey()  | 
                                                        |
| 203 | +        { | 
                                                        |
| 204 | 204 |          return getenv('INVALID_PUBLIC_KEY'); | 
                                                        
| 205 | - }  | 
                                                        |
| 205 | + }  | 
                                                        |
| 206 | 206 | }  | 
                                                        
| 207 | 207 | |
| 208 | 208 | |
@@ -72,7 +72,7 @@ discard block  | 
                                                    ||
| 72 | 72 | */  | 
                                                        
| 73 | 73 | private function prepareRequest()  | 
                                                        
| 74 | 74 |      { | 
                                                        
| 75 | - $this->client = new Client(['base_uri' => self::baseURL]);  | 
                                                        |
| 75 | + $this->client = new Client([ 'base_uri' => self::baseURL ]);  | 
                                                        |
| 76 | 76 | }  | 
                                                        
| 77 | 77 | |
| 78 | 78 | /**  | 
                                                        
@@ -83,7 +83,7 @@ discard block  | 
                                                    ||
| 83 | 83 | private function performGetRequest($relativeUrl)  | 
                                                        
| 84 | 84 |      { | 
                                                        
| 85 | 85 |          $this->response = $this->client->request('GET', $relativeUrl, [ | 
                                                        
| 86 | - 'auth' => [$this->publicKey, $this->accessToken]  | 
                                                        |
| 86 | + 'auth' => [ $this->publicKey, $this->accessToken ]  | 
                                                        |
| 87 | 87 | ]);  | 
                                                        
| 88 | 88 | }  | 
                                                        
| 89 | 89 | |
@@ -96,7 +96,7 @@ discard block  | 
                                                    ||
| 96 | 96 | private function performPostRequest($relativeUrl, $data)  | 
                                                        
| 97 | 97 |      { | 
                                                        
| 98 | 98 |          $this->response = $this->client->request('POST', $relativeUrl, [ | 
                                                        
| 99 | - 'auth' => [$this->publicKey, $this->accessToken],  | 
                                                        |
| 99 | + 'auth' => [ $this->publicKey, $this->accessToken ],  | 
                                                        |
| 100 | 100 | 'form_params' => $data  | 
                                                        
| 101 | 101 | ]);  | 
                                                        
| 102 | 102 | }  | 
                                                        
@@ -106,7 +106,7 @@ discard block  | 
                                                    ||
| 106 | 106 | * @param array $payload  | 
                                                        
| 107 | 107 | * @return $this  | 
                                                        
| 108 | 108 | */  | 
                                                        
| 109 | - public function sendSMS($payload = [])  | 
                                                        |
| 109 | + public function sendSMS($payload = [ ])  | 
                                                        |
| 110 | 110 |      { | 
                                                        
| 111 | 111 |          if (empty($payload)) { | 
                                                        
| 112 | 112 |              throw IsEmpty::create("Message Payload can not be empty. Please fill the appropriate details"); | 
                                                        
@@ -122,13 +122,13 @@ discard block  | 
                                                    ||
| 122 | 122 | * @param array $payload  | 
                                                        
| 123 | 123 | * @return $this  | 
                                                        
| 124 | 124 | */  | 
                                                        
| 125 | - public function sendBulkSMS($payload = [])  | 
                                                        |
| 125 | + public function sendBulkSMS($payload = [ ])  | 
                                                        |
| 126 | 126 |      { | 
                                                        
| 127 | 127 |          if (empty($payload)) { | 
                                                        
| 128 | 128 |              throw IsEmpty::create("Message Payload can not be empty. Please fill the appropriate details"); | 
                                                        
| 129 | 129 | }  | 
                                                        
| 130 | 130 | |
| 131 | -        if(empty($payload['to'])){ | 
                                                        |
| 131 | +        if (empty($payload[ 'to' ])) { | 
                                                        |
| 132 | 132 |              throw IsEmpty::create("Message destination can not be empty."); | 
                                                        
| 133 | 133 | }  | 
                                                        
| 134 | 134 | |