mirror of
https://github.com/retailcrm/mailgun-php.git
synced 2025-02-06 08:19:25 +03:00
Minor amends reported by Scrutinizer CI (#250)
* Scrutinizer CI: Bug The property deserializer does not seem to exist. Did you mean serializer? * Scrutinizer CI: Coding Style + Best Practice It seems like you are loosely comparing two booleans. Considering using the strict comparison === instead. * Scrutinizer CI: Bug It seems like $variables defined by parameter $variables on line ??? can also be of type null; however, Mailgun\Messages\MessageBuilder::addRecipient() does only seem to accept array, maybe add an additional type check? * Scrutinizer CI: Documentation The doc-type $class|SimpleResponse could not be parsed: Unknown type name "$class" at position 0 Adding `object` instead of `SimpleResponse` due we have no files called `SimpleResponse` in our project, and PhpDoc provides the `object` keyword as a valid option. https://www.phpdoc.org/docs/latest/guides/types.html#keywords * Scrutinizer CI: Documentation There is no parameter named $smtpPass. Did you maybe mean $smtpPassword? * Scrutinizer CI: Unused Code $resource is not used, you could remove the assignment. * Scrutinizer CI: Unused Code The parameter $message is not used and could be removed. * Scrutinizer CI: Unused code This method is not used, and could be removed. (x2) * Scrutinizer CI: Patch Doc Comments * Scrutinizer CI: Patch Doc comments
This commit is contained in:
parent
cc82355e50
commit
b61d5291b2
@ -32,7 +32,7 @@ abstract class HttpApi
|
|||||||
/**
|
/**
|
||||||
* @var ResponseDeserializer
|
* @var ResponseDeserializer
|
||||||
*/
|
*/
|
||||||
protected $serializer;
|
protected $deserializer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var RequestBuilder
|
* @var RequestBuilder
|
||||||
@ -59,7 +59,7 @@ abstract class HttpApi
|
|||||||
* @param ResponseInterface $response
|
* @param ResponseInterface $response
|
||||||
* @param string $className
|
* @param string $className
|
||||||
*
|
*
|
||||||
* @return $class|SimpleResponse
|
* @return object $class
|
||||||
*/
|
*/
|
||||||
protected function safeDeserialize(ResponseInterface $response, $className)
|
protected function safeDeserialize(ResponseInterface $response, $className)
|
||||||
{
|
{
|
||||||
|
@ -270,7 +270,6 @@ class RestClient
|
|||||||
protected function prepareFile($fieldName, $filePath, $fileIndex = 0)
|
protected function prepareFile($fieldName, $filePath, $fileIndex = 0)
|
||||||
{
|
{
|
||||||
$filename = null;
|
$filename = null;
|
||||||
$resource = null;
|
|
||||||
|
|
||||||
if (is_array($filePath) && isset($filePath['fileContent'])) {
|
if (is_array($filePath) && isset($filePath['fileContent'])) {
|
||||||
// File from memory
|
// File from memory
|
||||||
@ -316,7 +315,7 @@ class RestClient
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $uri
|
* @param string $uri
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
@ -78,7 +78,7 @@ class BatchMessage extends MessageBuilder
|
|||||||
{
|
{
|
||||||
if (array_key_exists($headerName, $this->counters['recipients'])) {
|
if (array_key_exists($headerName, $this->counters['recipients'])) {
|
||||||
if ($this->counters['recipients'][$headerName] == Api::RECIPIENT_COUNT_LIMIT) {
|
if ($this->counters['recipients'][$headerName] == Api::RECIPIENT_COUNT_LIMIT) {
|
||||||
if ($this->autoSend == false) {
|
if (false === $this->autoSend) {
|
||||||
throw new TooManyParameters(ExceptionMessages::TOO_MANY_RECIPIENTS);
|
throw new TooManyParameters(ExceptionMessages::TOO_MANY_RECIPIENTS);
|
||||||
}
|
}
|
||||||
$this->sendMessage();
|
$this->sendMessage();
|
||||||
|
@ -142,6 +142,9 @@ class MessageBuilder
|
|||||||
if ($this->counters['recipients']['to'] > Api::RECIPIENT_COUNT_LIMIT) {
|
if ($this->counters['recipients']['to'] > Api::RECIPIENT_COUNT_LIMIT) {
|
||||||
throw new TooManyParameters(ExceptionMessages::TOO_MANY_PARAMETERS_RECIPIENT);
|
throw new TooManyParameters(ExceptionMessages::TOO_MANY_PARAMETERS_RECIPIENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$variables = is_array($variables) ? $variables : [];
|
||||||
|
|
||||||
$this->addRecipient('to', $address, $variables);
|
$this->addRecipient('to', $address, $variables);
|
||||||
|
|
||||||
return end($this->message['to']);
|
return end($this->message['to']);
|
||||||
@ -160,6 +163,9 @@ class MessageBuilder
|
|||||||
if ($this->counters['recipients']['cc'] > Api::RECIPIENT_COUNT_LIMIT) {
|
if ($this->counters['recipients']['cc'] > Api::RECIPIENT_COUNT_LIMIT) {
|
||||||
throw new TooManyParameters(ExceptionMessages::TOO_MANY_PARAMETERS_RECIPIENT);
|
throw new TooManyParameters(ExceptionMessages::TOO_MANY_PARAMETERS_RECIPIENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$variables = is_array($variables) ? $variables : [];
|
||||||
|
|
||||||
$this->addRecipient('cc', $address, $variables);
|
$this->addRecipient('cc', $address, $variables);
|
||||||
|
|
||||||
return end($this->message['cc']);
|
return end($this->message['cc']);
|
||||||
@ -178,6 +184,9 @@ class MessageBuilder
|
|||||||
if ($this->counters['recipients']['bcc'] > Api::RECIPIENT_COUNT_LIMIT) {
|
if ($this->counters['recipients']['bcc'] > Api::RECIPIENT_COUNT_LIMIT) {
|
||||||
throw new TooManyParameters(ExceptionMessages::TOO_MANY_PARAMETERS_RECIPIENT);
|
throw new TooManyParameters(ExceptionMessages::TOO_MANY_PARAMETERS_RECIPIENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$variables = is_array($variables) ? $variables : [];
|
||||||
|
|
||||||
$this->addRecipient('bcc', $address, $variables);
|
$this->addRecipient('bcc', $address, $variables);
|
||||||
|
|
||||||
return end($this->message['bcc']);
|
return end($this->message['bcc']);
|
||||||
@ -191,6 +200,8 @@ class MessageBuilder
|
|||||||
*/
|
*/
|
||||||
public function setFromAddress($address, $variables = null)
|
public function setFromAddress($address, $variables = null)
|
||||||
{
|
{
|
||||||
|
$variables = is_array($variables) ? $variables : [];
|
||||||
|
|
||||||
$this->addRecipient('from', $address, $variables);
|
$this->addRecipient('from', $address, $variables);
|
||||||
|
|
||||||
return $this->message['from'];
|
return $this->message['from'];
|
||||||
@ -204,6 +215,8 @@ class MessageBuilder
|
|||||||
*/
|
*/
|
||||||
public function setReplyToAddress($address, $variables = null)
|
public function setReplyToAddress($address, $variables = null)
|
||||||
{
|
{
|
||||||
|
$variables = is_array($variables) ? $variables : [];
|
||||||
|
|
||||||
$this->addRecipient('h:reply-to', $address, $variables);
|
$this->addRecipient('h:reply-to', $address, $variables);
|
||||||
|
|
||||||
return $this->message['h:reply-to'];
|
return $this->message['h:reply-to'];
|
||||||
|
@ -82,6 +82,7 @@ final class CreateResponse implements ApiResponse
|
|||||||
$this->domain = $domainInfo;
|
$this->domain = $domainInfo;
|
||||||
$this->inboundDnsRecords = $rxRecords;
|
$this->inboundDnsRecords = $rxRecords;
|
||||||
$this->outboundDnsRecords = $txRecords;
|
$this->outboundDnsRecords = $txRecords;
|
||||||
|
$this->message = $message;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -72,7 +72,7 @@ final class Domain
|
|||||||
/**
|
/**
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @param string $smtpLogin
|
* @param string $smtpLogin
|
||||||
* @param string $smtpPass
|
* @param string $smtpPassword
|
||||||
* @param bool $wildcard
|
* @param bool $wildcard
|
||||||
* @param string $spamAction
|
* @param string $spamAction
|
||||||
* @param string $state
|
* @param string $state
|
||||||
|
@ -338,14 +338,6 @@ class ShowResponse implements ApiResponse
|
|||||||
return $this->attachments;
|
return $this->attachments;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param array $attachments
|
|
||||||
*/
|
|
||||||
private function setAttachments(array $attachments)
|
|
||||||
{
|
|
||||||
$this->attachments = $attachments;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
@ -370,14 +362,6 @@ class ShowResponse implements ApiResponse
|
|||||||
return $this->contentIdMap;
|
return $this->contentIdMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $contentIdMap
|
|
||||||
*/
|
|
||||||
private function setContentIdMap($contentIdMap)
|
|
||||||
{
|
|
||||||
$this->contentIdMap = $contentIdMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
|
@ -96,7 +96,7 @@ final class AllResponseItem
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return \string[]
|
* @return string[]
|
||||||
*/
|
*/
|
||||||
public function getTags()
|
public function getTags()
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user