summaryrefslogtreecommitdiffstats
path: root/lib/SparkPost/SparkPost.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/SparkPost/SparkPost.php')
-rw-r--r--lib/SparkPost/SparkPost.php7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/SparkPost/SparkPost.php b/lib/SparkPost/SparkPost.php
index 4228290..5c2a554 100644
--- a/lib/SparkPost/SparkPost.php
+++ b/lib/SparkPost/SparkPost.php
@@ -25,7 +25,12 @@ class SparkPost {
*/
public static function setConfig(array $configMap) {
//check for API key because its required
- if (!isset($configMap['key']) || empty(trim($configMap['key']))){
+ if (isset($configMap['key'])){
+ $key = trim($configMap['key']);
+ if(empty($key)){
+ throw new \Exception('You must provide an API key');
+ }
+ } else {
throw new \Exception('You must provide an API key');
}
self::$config = self::$defaults;