1 | <?php |
||
19 | final class SMSCClient implements SMSCClientInterface |
||
20 | { |
||
21 | /** |
||
22 | * The end point. |
||
23 | * |
||
24 | * @var string |
||
25 | */ |
||
26 | private static $endPoint; |
||
27 | |||
28 | /** |
||
29 | * The guzzle http client. |
||
30 | * |
||
31 | * @var GuzzleHttpClient |
||
32 | */ |
||
33 | protected $httpClient; |
||
34 | |||
35 | /** |
||
36 | * The request parameters. |
||
37 | * |
||
38 | * @var array |
||
39 | */ |
||
40 | protected $requestParams = []; |
||
41 | |||
42 | /** |
||
43 | * Initialize the dependencies. |
||
44 | * |
||
45 | * @param GuzzleHttpClient $client |
||
46 | * @param string $endpoint |
||
47 | * @param string $alias |
||
48 | * @param string $apikey |
||
49 | */ |
||
50 | public function __construct(GuzzleHttpClient $client, $endpoint, $alias, $apikey) |
||
55 | |||
56 | /** |
||
57 | * Load the sms service specific configurations. |
||
58 | * |
||
59 | * @param string $endpoint |
||
60 | * @param string $alias |
||
61 | * @param string $apikey |
||
62 | * @return void |
||
63 | * @throws CouldNotBootClient |
||
64 | */ |
||
65 | protected function boot($endpoint, $alias, $apikey) |
||
76 | |||
77 | /** |
||
78 | * Add an sms message to request. |
||
79 | * |
||
80 | * @param SMSCMessageInterface $smsMessage |
||
81 | * @return void |
||
82 | */ |
||
83 | public function addToRequest(SMSCMessageInterface $smsMessage) |
||
89 | |||
90 | /** |
||
91 | * Send the client request to the service. |
||
92 | * |
||
93 | * @throws CouldNotSendNotification If SMS Api returns false. |
||
94 | * @return SMSCApiResponseInterface |
||
95 | */ |
||
96 | public function sendRequest() |
||
115 | |||
116 | /** |
||
117 | * Validate the configuration provided api credentials. |
||
118 | * |
||
119 | * @param string $endpoint |
||
120 | * @param string $alias |
||
121 | * @param string $apikey |
||
122 | * @throws CouldNotBootClient |
||
123 | * @return bool |
||
124 | */ |
||
125 | private function hasCredentials($endpoint, $alias, $apikey) |
||
129 | } |
||
130 |