From ce484ecbc823ababb98e1402a98109a500a69e3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20Magn=C3=BAsson?= <32143325+Hannes-Magnusson-CK@users.noreply.github.com> Date: Wed, 22 Nov 2017 00:37:04 -0800 Subject: [PATCH] Grammar typo (#413) * Grammar typo * Fixed style errors as reported by styleci --- README.md | 2 +- src/Mailgun/Api/Domain.php | 2 +- src/Mailgun/Api/Event.php | 2 +- src/Mailgun/Api/HttpApi.php | 4 ++-- src/Mailgun/Api/Message.php | 4 ++-- src/Mailgun/Api/Pagination.php | 2 +- src/Mailgun/Api/Route.php | 2 +- src/Mailgun/Api/Stats.php | 2 +- src/Mailgun/Api/Suppression.php | 2 +- src/Mailgun/Api/Suppression/Bounce.php | 2 +- src/Mailgun/Api/Suppression/Complaint.php | 2 +- src/Mailgun/Api/Suppression/Unsubscribe.php | 2 +- src/Mailgun/Api/Tag.php | 2 +- src/Mailgun/Api/Webhook.php | 2 +- src/Mailgun/Assert.php | 2 +- .../Connection/Exceptions/GenericHTTPError.php | 2 +- .../Connection/Exceptions/InvalidCredentials.php | 2 +- .../Connection/Exceptions/MissingEndpoint.php | 2 +- .../Exceptions/MissingRequiredParameters.php | 2 +- .../Exceptions/NoDomainsConfigured.php | 2 +- src/Mailgun/Connection/RestClient.php | 10 +++++----- src/Mailgun/Constants/Api.php | 2 +- src/Mailgun/Constants/ExceptionMessages.php | 2 +- src/Mailgun/Exception.php | 2 +- src/Mailgun/Exception/HttpClientException.php | 4 ++-- src/Mailgun/Exception/HttpServerException.php | 2 +- src/Mailgun/Exception/HydrationException.php | 2 +- .../Exception/InvalidArgumentException.php | 2 +- src/Mailgun/Exception/UnknownErrorException.php | 2 +- src/Mailgun/HttpClient/Plugin/History.php | 2 +- .../HttpClient/Plugin/ReplaceUriPlugin.php | 2 +- src/Mailgun/HttpClientConfigurator.php | 6 +++--- src/Mailgun/Hydrator/ArrayHydrator.php | 4 ++-- src/Mailgun/Hydrator/Hydrator.php | 2 +- src/Mailgun/Hydrator/ModelHydrator.php | 4 ++-- src/Mailgun/Hydrator/NoopHydrator.php | 2 +- src/Mailgun/Lists/OptInHandler.php | 2 +- src/Mailgun/Mailgun.php | 4 ++-- src/Mailgun/Messages/BatchMessage.php | 4 ++-- .../Messages/Exceptions/InvalidParameter.php | 2 +- .../Messages/Exceptions/InvalidParameterType.php | 2 +- .../Exceptions/MissingRequiredMIMEParameters.php | 2 +- .../Messages/Exceptions/TooManyParameters.php | 2 +- src/Mailgun/Messages/MessageBuilder.php | 16 ++++++++-------- src/Mailgun/Model/ApiResponse.php | 2 +- src/Mailgun/Model/Domain/ConnectionResponse.php | 2 +- .../Model/Domain/CreateCredentialResponse.php | 2 +- src/Mailgun/Model/Domain/CreateResponse.php | 2 +- src/Mailgun/Model/Domain/CredentialResponse.php | 2 +- .../Model/Domain/CredentialResponseItem.php | 2 +- .../Model/Domain/DeleteCredentialResponse.php | 2 +- src/Mailgun/Model/Domain/DeleteResponse.php | 2 +- src/Mailgun/Model/Domain/DnsRecord.php | 2 +- src/Mailgun/Model/Domain/Domain.php | 2 +- src/Mailgun/Model/Domain/IndexResponse.php | 2 +- src/Mailgun/Model/Domain/ShowResponse.php | 2 +- .../Model/Domain/UpdateConnectionResponse.php | 2 +- .../Model/Domain/UpdateCredentialResponse.php | 2 +- src/Mailgun/Model/Domain/VerifyResponse.php | 2 +- src/Mailgun/Model/Event/Event.php | 2 +- src/Mailgun/Model/Event/EventResponse.php | 2 +- src/Mailgun/Model/Message/SendResponse.php | 2 +- src/Mailgun/Model/Message/ShowResponse.php | 2 +- src/Mailgun/Model/PaginationResponse.php | 2 +- src/Mailgun/Model/PagingProvider.php | 2 +- src/Mailgun/Model/Route/Action.php | 2 +- .../Model/Route/Response/CreateResponse.php | 2 +- .../Model/Route/Response/DeleteResponse.php | 2 +- .../Model/Route/Response/IndexResponse.php | 2 +- .../Model/Route/Response/ShowResponse.php | 2 +- .../Model/Route/Response/UpdateResponse.php | 2 +- src/Mailgun/Model/Route/Route.php | 2 +- src/Mailgun/Model/Stats/AllResponse.php | 2 +- src/Mailgun/Model/Stats/AllResponseItem.php | 2 +- src/Mailgun/Model/Stats/TotalResponse.php | 2 +- src/Mailgun/Model/Stats/TotalResponseItem.php | 2 +- src/Mailgun/Model/Suppression/BaseResponse.php | 2 +- src/Mailgun/Model/Suppression/Bounce/Bounce.php | 2 +- .../Model/Suppression/Bounce/CreateResponse.php | 2 +- .../Model/Suppression/Bounce/DeleteResponse.php | 2 +- .../Model/Suppression/Bounce/IndexResponse.php | 2 +- .../Model/Suppression/Bounce/ShowResponse.php | 2 +- .../Model/Suppression/Complaint/Complaint.php | 2 +- .../Suppression/Complaint/CreateResponse.php | 2 +- .../Suppression/Complaint/DeleteResponse.php | 2 +- .../Suppression/Complaint/IndexResponse.php | 2 +- .../Model/Suppression/Complaint/ShowResponse.php | 2 +- .../Suppression/Unsubscribe/CreateResponse.php | 2 +- .../Suppression/Unsubscribe/DeleteResponse.php | 2 +- .../Suppression/Unsubscribe/IndexResponse.php | 2 +- .../Suppression/Unsubscribe/ShowResponse.php | 2 +- .../Suppression/Unsubscribe/Unsubscribe.php | 2 +- src/Mailgun/Model/Tag/DeleteResponse.php | 2 +- src/Mailgun/Model/Tag/IndexResponse.php | 2 +- src/Mailgun/Model/Tag/ShowResponse.php | 2 +- src/Mailgun/Model/Tag/StatisticsResponse.php | 2 +- src/Mailgun/Model/Tag/Tag.php | 2 +- src/Mailgun/Model/Tag/UpdateResponse.php | 2 +- src/Mailgun/Model/Webhook/BaseResponse.php | 2 +- src/Mailgun/Model/Webhook/CreateResponse.php | 2 +- src/Mailgun/Model/Webhook/DeleteResponse.php | 2 +- src/Mailgun/Model/Webhook/IndexResponse.php | 4 ++-- src/Mailgun/Model/Webhook/ShowResponse.php | 2 +- src/Mailgun/Model/Webhook/UpdateResponse.php | 2 +- src/Mailgun/RequestBuilder.php | 6 +++--- tests/Api/MessageTest.php | 4 ++-- tests/Api/RouteTest.php | 2 +- tests/Api/StatsTest.php | 2 +- tests/Api/TagTest.php | 2 +- tests/Api/TestCase.php | 2 +- tests/Functional/FileFromMemoryTest.php | 4 ++-- tests/Functional/InlineFileTest.php | 3 ++- tests/Functional/MessageBuilderHeaderTest.php | 2 +- tests/Functional/MockedMailgun.php | 2 +- tests/Functional/MockedRestClient.php | 2 +- tests/Functional/SendMessageTest.php | 2 +- tests/Integration/DomainApiTest.php | 2 +- tests/Integration/RouteApiTest.php | 4 ++-- tests/Lists/OptInHandlerTest.php | 2 +- tests/MailgunTest.php | 2 +- tests/MailgunTestCase.php | 2 +- tests/Messages/BatchMessageTest.php | 2 +- tests/Messages/ComplexMessageTest.php | 12 ++++++------ tests/Messages/MessageBuilderTest.php | 2 +- tests/Messages/StandardMessageTest.php | 2 +- tests/Mock/Connection/TestBroker.php | 12 ++++++------ tests/Mock/Mailgun.php | 2 +- tests/RequestBuilderTest.php | 11 +++++------ 128 files changed, 169 insertions(+), 169 deletions(-) diff --git a/README.md b/README.md index 8d08cf6..215d6de 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ php composer.phar require mailgun/mailgun-php php-http/curl-client guzzlehttp/ps ### Why requiring so many packages? Mailgun has a dependency on the virtual package -[php-http/client-implementation](https://packagist.org/providers/php-http/client-implementation) which requires to you install **an** adapter, but we do not care which one. That is an implementation detail in your application. We also need **a** PSR-7 implementation and **a** message factory. +[php-http/client-implementation](https://packagist.org/providers/php-http/client-implementation) which requires you to install **an** adapter, but we do not care which one. That is an implementation detail in your application. We also need **a** PSR-7 implementation and **a** message factory. You do not have to use the `php-http/curl-client` if you do not want to. You may use the `php-http/guzzle6-adapter`. Read more about the virtual packages, why this is a good idea and about the flexibility it brings at the [HTTPlug docs](http://docs.php-http.org/en/latest/httplug/users.html). diff --git a/src/Mailgun/Api/Domain.php b/src/Mailgun/Api/Domain.php index a63c796..6b85d6f 100644 --- a/src/Mailgun/Api/Domain.php +++ b/src/Mailgun/Api/Domain.php @@ -1,7 +1,7 @@ getStatusCode() !== 200 && $response->getStatusCode() !== 201) { + if (200 !== $response->getStatusCode() && 201 !== $response->getStatusCode()) { $this->handleErrors($response); } diff --git a/src/Mailgun/Api/Message.php b/src/Mailgun/Api/Message.php index cdbfd87..20c255a 100644 --- a/src/Mailgun/Api/Message.php +++ b/src/Mailgun/Api/Message.php @@ -1,7 +1,7 @@ http_response_body = $data && $jsonResponseData === null ? $data : $jsonResponseData; + $result->http_response_body = $data && null === $jsonResponseData ? $data : $jsonResponseData; $result->http_response_code = $httpResponseCode; return $result; @@ -270,7 +270,7 @@ class RestClient { $body = (string) $responseObj->getBody(); $response = json_decode($body); - if (json_last_error() == JSON_ERROR_NONE && isset($response->message)) { + if (JSON_ERROR_NONE == json_last_error() && isset($response->message)) { return ' '.$response->message; } @@ -303,7 +303,7 @@ class RestClient } // Remove leading @ symbol - if (strpos($filePath, '@') === 0) { + if (0 === strpos($filePath, '@')) { $filePath = substr($filePath, 1); } @@ -322,7 +322,7 @@ class RestClient */ protected function getHttpClient() { - if ($this->httpClient === null) { + if (null === $this->httpClient) { $this->httpClient = HttpClientDiscovery::find(); } diff --git a/src/Mailgun/Constants/Api.php b/src/Mailgun/Constants/Api.php index 16eadd8..0b5384f 100644 --- a/src/Mailgun/Constants/Api.php +++ b/src/Mailgun/Constants/Api.php @@ -1,7 +1,7 @@ response = $response; $this->responseCode = $response->getStatusCode(); $body = $response->getBody()->__toString(); - if (strpos($response->getHeaderLine('Content-Type'), 'application/json') !== 0) { + if (0 !== strpos($response->getHeaderLine('Content-Type'), 'application/json')) { $this->responseBody['message'] = $body; } else { $this->responseBody = json_decode($body, true); diff --git a/src/Mailgun/Exception/HttpServerException.php b/src/Mailgun/Exception/HttpServerException.php index bb1bf52..0bb3264 100644 --- a/src/Mailgun/Exception/HttpServerException.php +++ b/src/Mailgun/Exception/HttpServerException.php @@ -1,7 +1,7 @@ uriFactory === null) { + if (null === $this->uriFactory) { $this->uriFactory = UriFactoryDiscovery::find(); } @@ -156,7 +156,7 @@ final class HttpClientConfigurator */ private function getHttpClient() { - if ($this->httpClient === null) { + if (null === $this->httpClient) { $this->httpClient = HttpClientDiscovery::find(); } diff --git a/src/Mailgun/Hydrator/ArrayHydrator.php b/src/Mailgun/Hydrator/ArrayHydrator.php index 4174a5e..cbb1d17 100644 --- a/src/Mailgun/Hydrator/ArrayHydrator.php +++ b/src/Mailgun/Hydrator/ArrayHydrator.php @@ -1,7 +1,7 @@ getBody()->__toString(); - if (strpos($response->getHeaderLine('Content-Type'), 'application/json') !== 0) { + if (0 !== strpos($response->getHeaderLine('Content-Type'), 'application/json')) { throw new HydrationException('The ArrayHydrator cannot hydrate response with Content-Type:'.$response->getHeaderLine('Content-Type')); } diff --git a/src/Mailgun/Hydrator/Hydrator.php b/src/Mailgun/Hydrator/Hydrator.php index ac03eb0..314db97 100644 --- a/src/Mailgun/Hydrator/Hydrator.php +++ b/src/Mailgun/Hydrator/Hydrator.php @@ -1,7 +1,7 @@ getBody()->__toString(); $contentType = $response->getHeaderLine('Content-Type'); - if (strpos($contentType, 'application/json') !== 0 && strpos($contentType, 'application/octet-stream') !== 0) { + if (0 !== strpos($contentType, 'application/json') && 0 !== strpos($contentType, 'application/octet-stream')) { throw new HydrationException('The ModelHydrator cannot hydrate response with Content-Type: '.$contentType); } diff --git a/src/Mailgun/Hydrator/NoopHydrator.php b/src/Mailgun/Hydrator/NoopHydrator.php index f5d8c43..2f82fb9 100644 --- a/src/Mailgun/Hydrator/NoopHydrator.php +++ b/src/Mailgun/Hydrator/NoopHydrator.php @@ -1,7 +1,7 @@ message[$headerName])) { array_push($this->message[$headerName], $compiledAddress); - } elseif ($headerName == 'h:reply-to') { + } elseif ('h:reply-to' == $headerName) { $this->message[$headerName] = $compiledAddress; } else { $this->message[$headerName] = [$compiledAddress]; diff --git a/src/Mailgun/Messages/Exceptions/InvalidParameter.php b/src/Mailgun/Messages/Exceptions/InvalidParameter.php index 9520e41..d2b691c 100644 --- a/src/Mailgun/Messages/Exceptions/InvalidParameter.php +++ b/src/Mailgun/Messages/Exceptions/InvalidParameter.php @@ -1,7 +1,7 @@ getFullName($variables); - if ($fullName != null) { + if (null != $fullName) { return sprintf('"%s" <%s>', $fullName, $address); } @@ -117,7 +117,7 @@ class MessageBuilder { $compiledAddress = $this->parseAddress($address, $variables); - if ($headerName === 'h:reply-to') { + if ('h:reply-to' === $headerName) { $this->message[$headerName] = $compiledAddress; } elseif (isset($this->message[$headerName])) { array_push($this->message[$headerName], $compiledAddress); @@ -229,7 +229,7 @@ class MessageBuilder */ public function setSubject($subject = '') { - if ($subject == null || $subject == '') { + if (null == $subject || '' == $subject) { $subject = ' '; } $this->message['subject'] = $subject; @@ -269,7 +269,7 @@ class MessageBuilder */ public function setTextBody($textBody) { - if ($textBody == null || $textBody == '') { + if (null == $textBody || '' == $textBody) { $textBody = ' '; } $this->message['text'] = $textBody; @@ -284,7 +284,7 @@ class MessageBuilder */ public function setHtmlBody($htmlBody) { - if ($htmlBody == null || $htmlBody == '') { + if (null == $htmlBody || '' == $htmlBody) { $htmlBody = ' '; } $this->message['html'] = $htmlBody; @@ -328,7 +328,7 @@ class MessageBuilder */ public function addInlineImage($inlineImagePath, $inlineImageName = null) { - if (strpos($inlineImagePath, '@') !== 0) { + if (0 !== strpos($inlineImagePath, '@')) { throw new InvalidParameter(ExceptionMessages::INVALID_PARAMETER_INLINE); } @@ -444,7 +444,7 @@ class MessageBuilder { if (filter_var($enabled, FILTER_VALIDATE_BOOLEAN)) { $enabled = 'yes'; - } elseif ($enabled == 'html') { + } elseif ('html' == $enabled) { $enabled = 'html'; } else { $enabled = 'no'; diff --git a/src/Mailgun/Model/ApiResponse.php b/src/Mailgun/Model/ApiResponse.php index b176214..aa22485 100644 --- a/src/Mailgun/Model/ApiResponse.php +++ b/src/Mailgun/Model/ApiResponse.php @@ -1,7 +1,7 @@ setBounce($data['bounce']); } diff --git a/src/Mailgun/Model/Webhook/ShowResponse.php b/src/Mailgun/Model/Webhook/ShowResponse.php index 10a64c1..7acb2de 100644 --- a/src/Mailgun/Model/Webhook/ShowResponse.php +++ b/src/Mailgun/Model/Webhook/ShowResponse.php @@ -1,7 +1,7 @@ requestFactory === null) { + if (null === $this->requestFactory) { $this->requestFactory = MessageFactoryDiscovery::find(); } @@ -100,7 +100,7 @@ class RequestBuilder */ private function getMultipartStreamBuilder() { - if ($this->multipartStreamBuilder === null) { + if (null === $this->multipartStreamBuilder) { $this->multipartStreamBuilder = new MultipartStreamBuilder(); } diff --git a/tests/Api/MessageTest.php b/tests/Api/MessageTest.php index 6b857fc..cc1fd76 100644 --- a/tests/Api/MessageTest.php +++ b/tests/Api/MessageTest.php @@ -1,7 +1,7 @@ assertContainsOnlyInstancesOf(Route::class, $response->getRoutes()); $foundTestRoute = false; foreach ($response->getRoutes() as $route) { - if ($route->getId() === $routeId && $route->getDescription() === 'test-route-updated') { + if ($route->getId() === $routeId && 'test-route-updated' === $route->getDescription()) { $foundTestRoute = true; } } diff --git a/tests/Lists/OptInHandlerTest.php b/tests/Lists/OptInHandlerTest.php index f4cd433..754c72a 100644 --- a/tests/Lists/OptInHandlerTest.php +++ b/tests/Lists/OptInHandlerTest.php @@ -1,7 +1,7 @@ files as $file) { - if ($file['name'] == 'to') { + if ('to' == $file['name']) { $this->assertEquals($file['contents'], 'test@test.mailgun.org'); ++$testCount; } - if ($file['name'] == 'from') { + if ('from' == $file['name']) { $this->assertEquals($file['contents'], 'sender@test.mailgun.org'); ++$testCount; } - if ($file['name'] == 'subject') { + if ('subject' == $file['name']) { $this->assertEquals($file['contents'], 'This is my test subject'); ++$testCount; } - if ($file['name'] == 'text') { + if ('text' == $file['name']) { $this->assertEquals($file['contents'], 'Testing!'); ++$testCount; } - if ($file['name'] == 'inline') { + if ('inline' == $file['name']) { $expectedFilename = array_shift($expectedFilenames); $this->assertNotNull($expectedFilename); $this->assertSame($expectedFilename, $file['filename']); diff --git a/tests/Messages/MessageBuilderTest.php b/tests/Messages/MessageBuilderTest.php index 46c8c39..3414ec0 100644 --- a/tests/Messages/MessageBuilderTest.php +++ b/tests/Messages/MessageBuilderTest.php @@ -1,7 +1,7 @@ http_response_body = new \stdClass(); $jsonResponseData = json_decode('{"message": "Some JSON Response Data", "id": "1234"}'); foreach ($jsonResponseData as $key => $value) { $result->http_response_body->$key = $value; } - } elseif ($httpResponseCode == 400) { + } elseif (400 == $httpResponseCode) { throw new MissingRequiredMIMEParameters(EXCEPTION_MISSING_REQUIRED_MIME_PARAMETERS); - } elseif ($httpResponseCode == 401) { + } elseif (401 == $httpResponseCode) { throw new InvalidCredentials(EXCEPTION_INVALID_CREDENTIALS); - } elseif ($httpResponseCode == 401) { + } elseif (401 == $httpResponseCode) { throw new GenericHTTPError(EXCEPTION_INVALID_CREDENTIALS); - } elseif ($httpResponseCode == 404) { + } elseif (404 == $httpResponseCode) { throw new MissingEndpoint(EXCEPTION_MISSING_ENDPOINT); } else { throw new GenericHTTPError(EXCEPTION_GENERIC_HTTP_ERROR); diff --git a/tests/Mock/Mailgun.php b/tests/Mock/Mailgun.php index c50f417..9633b47 100644 --- a/tests/Mock/Mailgun.php +++ b/tests/Mock/Mailgun.php @@ -1,7 +1,7 @@ 'foobar', 'name' => 'username', 'some_stuff' => 'some value']; $item1 = ['content' => 'Stockholm', 'name' => 'city', 'other_stuff' => 'other value']; - $body = [$item0, $item1]; - + $body = [$item0, $item1]; foreach ($body as $index => $item) { $multipartStreamBuilder @@ -145,7 +144,7 @@ class RequestBuilderTest extends PHPUnit_Framework_TestCase } /** - * Creates multipart stream builder + * Creates multipart stream builder. * * @return MockObject|MultipartStreamBuilder */