summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/MessageSystems/Configuration.php2
-rw-r--r--lib/MessageSystems/SendGridCompatibility/Email.php84
-rw-r--r--lib/MessageSystems/SendGridCompatibility/SDK.php24
-rw-r--r--lib/MessageSystems/Transmission.php6
-rw-r--r--lib/SparkPost.php14
5 files changed, 16 insertions, 114 deletions
diff --git a/lib/MessageSystems/Configuration.php b/lib/MessageSystems/Configuration.php
index 106d1d5..d44cab3 100644
--- a/lib/MessageSystems/Configuration.php
+++ b/lib/MessageSystems/Configuration.php
@@ -23,7 +23,7 @@ class Configuration {
* @param Array $configMap - Hashmap that contains config values for the SDK to connect to SparkPost
* @throws \Exception
*/
- public static function setConfig($configMap) {
+ public static function setConfig(array $configMap) {
//check for API key because its required
if (!isset($configMap['key']) || empty(trim($configMap['key']))){
throw new \Exception('You must provide an API key');
diff --git a/lib/MessageSystems/SendGridCompatibility/Email.php b/lib/MessageSystems/SendGridCompatibility/Email.php
deleted file mode 100644
index 68c94b7..0000000
--- a/lib/MessageSystems/SendGridCompatibility/Email.php
+++ /dev/null
@@ -1,84 +0,0 @@
-<?php
-namespace MessageSystems\SendGridCompatibility;
-
-use MessageSystems\Transmission;
-
-class Email {
- private $transmission;
-
- public function __construct() {
- $this->transmission = new Transmission();
- }
-
- public function send() {
- $this->transmission->send();
- }
-
- public function addTo($address) {
- $this->transmission->addRecipient($address);
- return $this;
- }
-
- public function setTos(Array $addresses) {
- $this->transmission->addRecipients($addresses);
- return $this;
- }
-
- /**
- *
- * @param string $address
- * @return \MessageSystems\SendGridCompatibility\Email
- */
- public function setFrom($address) {
- $this->transmission->setFrom($address);
- return $this;
- }
-
- /**
- * TODO:figure this out
- * @param string $name
- */
- public function setFromName($name) {
-
- return $this;
- }
-
-
- /**
- *
- * @param string $address
- * @return \MessageSystems\SendGridCompatibility\Email
- */
- public function setReplyTo($address) {
- $this->transmission->setReplyTo($address);
- return $this;
- }
-
- /**
- * TODO: Does this work?
- *
- *
- * @param string $address
- * @return \MessageSystems\SendGridCompatibility\Email
- */
- public function addBcc($address) {
- $this->transmission->addRecipient($address);
- return $this;
- }
-
- public function setSubject($subject) {
- $this->transmission->setSubject($subject);
- return $this;
- }
-
- public function setText($text) {
- $this->transmission->setTextContent($text);
- return $this;
- }
-
- public function setHtml($html) {
- $this->transmission->setHTMLContent($html);
- return $this;
- }
-}
-?> \ No newline at end of file
diff --git a/lib/MessageSystems/SendGridCompatibility/SDK.php b/lib/MessageSystems/SendGridCompatibility/SDK.php
deleted file mode 100644
index f1a4df3..0000000
--- a/lib/MessageSystems/SendGridCompatibility/SDK.php
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-namespace MessageSystems\SendGridCompatibility;
-
-use MessageSystems\Transmission;
-use MessageSystems\SendGridCompatibility\Email;
-use MessageSystems\Configuration;
-
-class SDK{
- private $sparkPost;
-
- public function __construct($username, $password, $options = null) {
- //username isn't used in our system
- $opts = ['key'=>$password];
- if (!is_null($options)) {
- $opts = array_merge($opts, $options);
- }
- Configuration::setConfig($opts);
- }
-
- public function send(Email $email) {
- $email->send();
- }
-}
-?> \ No newline at end of file
diff --git a/lib/MessageSystems/Transmission.php b/lib/MessageSystems/Transmission.php
index 294ec01..2b4b9cc 100644
--- a/lib/MessageSystems/Transmission.php
+++ b/lib/MessageSystems/Transmission.php
@@ -420,7 +420,7 @@ class Transmission {
* @param array $headers Key-value pairs of headers to add to the content of a Transmission
* @return \MessageSystems\Transmission Object
*/
- public function setContentHeaders (Array $headers) {
+ public function setContentHeaders (array $headers) {
$this->model['content']['headers'] = $headers;
return $this;
}
@@ -439,7 +439,7 @@ class Transmission {
* @param array $recipient An associative array of recipient data to send a Transmission
* @return \MessageSystems\Transmission Object
*/
- public function addRecipient (Array $recipient) {
+ public function addRecipient (array $recipient) {
if(!is_array($this->model['recipients'])) {
$this->model['recipients'] = [];
}
@@ -460,7 +460,7 @@ class Transmission {
* @param array $recipients An array of associative arrays containing recipient data
* @return \MessageSystems\Transmission Object
*/
- public function addRecipients (Array $recipients) {
+ public function addRecipients (array $recipients) {
if(!is_array($this->model['recipients'])) {
$this->model['recipients'] = [];
}
diff --git a/lib/SparkPost.php b/lib/SparkPost.php
index 2a4b589..539b0db 100644
--- a/lib/SparkPost.php
+++ b/lib/SparkPost.php
@@ -8,11 +8,21 @@ class SparkPost {
public $transmission;
- public function __construct($globalOpts) {
+ /**
+ * @desc Sets up the config for the sdk suite
+ * @param array $globalOpts
+ */
+ public function __construct(array $globalOpts) {
Configuration::setConfig($globalOpts);
}
- public function Transmission(Array $options = null) {
+ /**
+ * @desc Creates a new Transmission object and returns it.
+ * @param array $options Transmission constructor options
+ * @see \MessageSystems\Transmission
+ * @return \MessageSystems\Transmission
+ */
+ public function Transmission(array $options = null) {
$this->transmission = new Transmission($options);
return $this->transmission;
}