From 869eff42e18f2d4b121147896d4a1a55b8eceaad Mon Sep 17 00:00:00 2001 From: Quentin Date: Tue, 19 Dec 2017 18:38:09 +0100 Subject: [PATCH] style: Fix coding style. --- .../Connection/Exceptions/GenericHTTPError.php | 1 + src/Mailgun/Constants/Api.php | 6 ++++++ src/Mailgun/Constants/ExceptionMessages.php | 11 +++++++++++ tests/Messages/BatchMessageTest.php | 1 + tests/Mock/Mailgun.php | 1 + 5 files changed, 20 insertions(+) diff --git a/src/Mailgun/Connection/Exceptions/GenericHTTPError.php b/src/Mailgun/Connection/Exceptions/GenericHTTPError.php index 955209a..641104d 100644 --- a/src/Mailgun/Connection/Exceptions/GenericHTTPError.php +++ b/src/Mailgun/Connection/Exceptions/GenericHTTPError.php @@ -17,6 +17,7 @@ use Mailgun\Exception; class GenericHTTPError extends \Exception implements Exception { protected $httpResponseCode; + protected $httpResponseBody; public function __construct($message = null, $response_code = null, $response_body = null, $code = 0, \Exception $previous = null) diff --git a/src/Mailgun/Constants/Api.php b/src/Mailgun/Constants/Api.php index 0b5384f..affb93d 100644 --- a/src/Mailgun/Constants/Api.php +++ b/src/Mailgun/Constants/Api.php @@ -15,10 +15,16 @@ namespace Mailgun\Constants; class Api { const API_USER = 'api'; + const SDK_VERSION = '1.7'; + const SDK_USER_AGENT = 'mailgun-sdk-php'; + const RECIPIENT_COUNT_LIMIT = 1000; + const CAMPAIGN_ID_LIMIT = 3; + const TAG_LIMIT = 3; + const DEFAULT_TIME_ZONE = 'UTC'; } diff --git a/src/Mailgun/Constants/ExceptionMessages.php b/src/Mailgun/Constants/ExceptionMessages.php index 27db189..dca250c 100644 --- a/src/Mailgun/Constants/ExceptionMessages.php +++ b/src/Mailgun/Constants/ExceptionMessages.php @@ -15,15 +15,26 @@ namespace Mailgun\Constants; class ExceptionMessages { const EXCEPTION_INVALID_CREDENTIALS = 'Your credentials are incorrect.'; + const EXCEPTION_GENERIC_HTTP_ERROR = 'An HTTP Error has occurred! Check your network connection and try again.'; + const EXCEPTION_MISSING_REQUIRED_PARAMETERS = 'The parameters passed to the API were invalid. Check your inputs!'; + const EXCEPTION_MISSING_REQUIRED_MIME_PARAMETERS = 'The parameters passed to the API were invalid. Check your inputs!'; + const EXCEPTION_MISSING_ENDPOINT = "The endpoint you've tried to access does not exist. Check if the domain matches the domain you have configure on Mailgun."; + const TOO_MANY_RECIPIENTS = "You've exceeded the maximum recipient count (1,000) on the to field with autosend disabled."; + const INVALID_PARAMETER_NON_ARRAY = "The parameter you've passed in position 2 must be an array."; + const INVALID_PARAMETER_ATTACHMENT = 'Attachments must be passed with an "@" preceding the file path. Web resources not supported.'; + const INVALID_PARAMETER_INLINE = 'Inline images must be passed with an "@" preceding the file path. Web resources not supported.'; + const TOO_MANY_PARAMETERS_CAMPAIGNS = "You've exceeded the maximum (3) campaigns for a single message."; + const TOO_MANY_PARAMETERS_TAGS = "You've exceeded the maximum (3) tags for a single message."; + const TOO_MANY_PARAMETERS_RECIPIENT = "You've exceeded the maximum recipient count (1,000) on the to field with autosend disabled."; } diff --git a/tests/Messages/BatchMessageTest.php b/tests/Messages/BatchMessageTest.php index 4fa4417..ce8305e 100644 --- a/tests/Messages/BatchMessageTest.php +++ b/tests/Messages/BatchMessageTest.php @@ -14,6 +14,7 @@ use Mailgun\Tests\Mock\Mailgun; class BatchMessageTest extends \Mailgun\Tests\MailgunTestCase { private $client; + private $sampleDomain = 'samples.mailgun.org'; public function setUp() diff --git a/tests/Mock/Mailgun.php b/tests/Mock/Mailgun.php index 9633b47..53c3ec0 100644 --- a/tests/Mock/Mailgun.php +++ b/tests/Mock/Mailgun.php @@ -15,6 +15,7 @@ use Mailgun\Tests\Mock\Connection\TestBroker; class Mailgun extends Base { protected $debug; + protected $restClient; public function __construct($apiKey = null, $apiEndpoint = 'api.mailgun.net', $apiVersion = 'v3')