From 24ddfa0e549a7c54913707f4de96e0abe65a38f3 Mon Sep 17 00:00:00 2001 From: Travis Swientek Date: Thu, 25 Jul 2013 14:07:06 -0700 Subject: [PATCH] Fixed weird commit and merge issues --- src/Mailgun/MailgunClient.php | 76 +++++++++++++++++------------------ src/Mailgun/globals.php | 2 - 2 files changed, 38 insertions(+), 40 deletions(-) diff --git a/src/Mailgun/MailgunClient.php b/src/Mailgun/MailgunClient.php index 68413d6..b22524e 100644 --- a/src/Mailgun/MailgunClient.php +++ b/src/Mailgun/MailgunClient.php @@ -2,48 +2,48 @@ namespace Mailgun; -use Mailgun\Connection\HttpBroker; -use Mailgun\Unsubscribes\Unsubscribes; +use Mailgun\Logs\Logs; +use Mailgun\Stats\Stats; +use Mailgun\Bounces\Bounces; use Mailgun\Messages\Messages; use Mailgun\Complaints\Complaints; -use Mailgun\Bounces\Bounces; -use Mailgun\Stats\Stats; -use Mailgun\Logs\Logs; - - -use Mailgun\Connection\Exceptions\NoDomainsConfigured; -use Mailgun\Connection\Exceptions\InvalidCredentials; -use Mailgun\Connection\Exceptions\MissingRequiredMIMEParameters; -use Mailgun\Connection\Exceptions\GenericHTTPError; +use Mailgun\Connection\HttpBroker; +use Mailgun\Unsubscribes\Unsubscribes; class MailgunClient{ - - protected $debug; - protected $httpBroker; - - public function __construct($apiKey, $domain, $debug = false){ - $this->httpBroker = new HttpBroker($apiKey, $domain, $debug); - } - - //Factory Methods for Class Creation from MailgunClient - public function Messages(){ - return new Messages($this->httpBroker); - } - public function Unsubscribes(){ - return new Unsubscribes($this->httpBroker); - } - public function Complaints(){ - return new Complaints($this->httpBroker); - } - public function Bounces(){ - return new Bounces($this->httpBroker); - } - public function Stats(){ - return new Stats($this->httpBroker); - } - public function Logs(){ - return new Logs($this->httpBroker); - } + + /* + * Instantiate the HttpBroker to make it available to all + * classes created from here. + */ + + public function __construct($apiKey, $domain, $debug = false){ + $this->httpBroker = new HttpBroker($apiKey, $domain, $debug); + } + + /* + * Factory methods for instantiating each endpoint class. + * If a new endpoint is added, create a factory method here. + */ + + public function Messages(){ + return new Messages($this->httpBroker); + } + public function Unsubscribes(){ + return new Unsubscribes($this->httpBroker); + } + public function Complaints(){ + return new Complaints($this->httpBroker); + } + public function Bounces(){ + return new Bounces($this->httpBroker); + } + public function Stats(){ + return new Stats($this->httpBroker); + } + public function Logs(){ + return new Logs($this->httpBroker); + } } ?> \ No newline at end of file diff --git a/src/Mailgun/globals.php b/src/Mailgun/globals.php index a6ca1e1..c94b7be 100644 --- a/src/Mailgun/globals.php +++ b/src/Mailgun/globals.php @@ -7,7 +7,5 @@ const API_USER = "api"; const SDK_VERSION = "0.1"; const SDK_USER_AGENT = "mailgun-sdk-php"; const DEFAULT_TIME_ZONE = "UTC"; -const DEFAULT_MG_API_KEY = "key-3ax6xnjp29jd6fds4gc373sgvjxteol0"; -const DEFAULT_MG_DOMAIN = "samples.mailgun.org"; ?> \ No newline at end of file