diff options
Diffstat (limited to 'lib/SparkPost/SparkPost.php')
-rw-r--r-- | lib/SparkPost/SparkPost.php | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/SparkPost/SparkPost.php b/lib/SparkPost/SparkPost.php index 14af3cd..5c2a554 100644 --- a/lib/SparkPost/SparkPost.php +++ b/lib/SparkPost/SparkPost.php @@ -4,14 +4,14 @@ namespace SparkPost; class SparkPost { private static $config; - private static $defaults = [ + private static $defaults = array( 'host'=>'api.sparkpost.com', 'protocol'=>'https', 'port'=>443, 'strictSSL'=>true, 'key'=>'', 'version'=>'v1' - ]; + ); /** * Enforce that this object can't be instansiated @@ -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; |