@@ -40,11 +40,6 @@ class SparkPost {
40
40
* its just they API Key.
41
41
*/
42
42
public function __construct ($ httpAdapter , $ settingsConfig ) {
43
- // if the config map is a string we should assume that its an api key
44
- if (gettype ($ settingsConfig ) === 'string ' ) {
45
- $ settingsConfig = ['key ' =>$ settingsConfig ];
46
- }
47
-
48
43
//config needs to be setup before adapter because of default adapter settings
49
44
$ this ->setConfig ($ settingsConfig );
50
45
$ this ->setHttpAdapter ($ httpAdapter );
@@ -114,10 +109,17 @@ public function setHttpAdapter($httpAdapter) {
114
109
115
110
/**
116
111
* Allows the user to pass in values to override the defaults and set their API key
117
- * @param Array $settingsConfig - Hashmap that contains config values for the SDK to connect to SparkPost
112
+ * @param String | Array $settingsConfig - Hashmap that contains config values
113
+ * for the SDK to connect to SparkPost. If its a string we assume that
114
+ * its just they API Key.
118
115
* @throws \Exception
119
116
*/
120
- public function setConfig (Array $ settingsConfig ) {
117
+ public function setConfig ($ settingsConfig ) {
118
+ // if the config map is a string we should assume that its an api key
119
+ if (gettype ($ settingsConfig ) === 'string ' ) {
120
+ $ settingsConfig = ['key ' =>$ settingsConfig ];
121
+ }
122
+
121
123
// Validate API key because its required
122
124
if (!isset ($ settingsConfig ['key ' ]) || empty (trim ($ settingsConfig ['key ' ]))){
123
125
throw new \Exception ('You must provide an API key ' );
0 commit comments