mirror of
https://github.com/retailcrm/mailgun-php.git
synced 2025-02-06 08:19:25 +03:00
Minor bugfixes detected with PHPStan
This commit is contained in:
parent
dd7c1d2361
commit
34432e0517
@ -34,7 +34,7 @@ abstract class HttpApi
|
|||||||
protected $httpClient;
|
protected $httpClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Hydrator
|
* @var null|Hydrator
|
||||||
*/
|
*/
|
||||||
protected $hydrator;
|
protected $hydrator;
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ abstract class HttpApi
|
|||||||
*/
|
*/
|
||||||
protected function hydrateResponse(ResponseInterface $response, string $class)
|
protected function hydrateResponse(ResponseInterface $response, string $class)
|
||||||
{
|
{
|
||||||
if (!$this->hydrator) {
|
if (null === $this->hydrator) {
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ class Member extends HttpApi
|
|||||||
*
|
*
|
||||||
* @param string $address Address of the mailing list
|
* @param string $address Address of the mailing list
|
||||||
* @param int $limit Maximum number of records to return (optional: 100 by default)
|
* @param int $limit Maximum number of records to return (optional: 100 by default)
|
||||||
* @param string|null $subscribed `true` to lists subscribed, `false` for unsubscribed. list all if null
|
* @param bool|null $subscribed `true` to lists subscribed, `false` for unsubscribed. list all if null
|
||||||
*
|
*
|
||||||
* @return IndexResponse
|
* @return IndexResponse
|
||||||
*
|
*
|
||||||
|
@ -96,7 +96,7 @@ class Route extends HttpApi
|
|||||||
*
|
*
|
||||||
* @param string $routeId Route ID returned by the Routes::index() method
|
* @param string $routeId Route ID returned by the Routes::index() method
|
||||||
* @param string|null $expression A filter expression like "match_recipient('.*@gmail.com')"
|
* @param string|null $expression A filter expression like "match_recipient('.*@gmail.com')"
|
||||||
* @param array|null $actions Route action. This action is executed when the expression evaluates to True. Example: "forward('alice@example.com')"
|
* @param array $actions Route action. This action is executed when the expression evaluates to True. Example: "forward('alice@example.com')"
|
||||||
* @param string|null $description An arbitrary string
|
* @param string|null $description An arbitrary string
|
||||||
* @param int|null $priority Integer: smaller number indicates higher priority. Higher priority routes are handled first. Defaults to 0.
|
* @param int|null $priority Integer: smaller number indicates higher priority. Higher priority routes are handled first. Defaults to 0.
|
||||||
*
|
*
|
||||||
|
@ -12,7 +12,10 @@ declare(strict_types=1);
|
|||||||
namespace Mailgun;
|
namespace Mailgun;
|
||||||
|
|
||||||
use Http\Client\Common\HttpMethodsClient;
|
use Http\Client\Common\HttpMethodsClient;
|
||||||
|
use Http\Client\HttpClient;
|
||||||
|
use Mailgun\HttpClient\HttpClientConfigurator;
|
||||||
use Mailgun\HttpClient\Plugin\History;
|
use Mailgun\HttpClient\Plugin\History;
|
||||||
|
use Mailgun\HttpClient\RequestBuilder;
|
||||||
use Mailgun\Hydrator\ModelHydrator;
|
use Mailgun\Hydrator\ModelHydrator;
|
||||||
use Mailgun\Hydrator\Hydrator;
|
use Mailgun\Hydrator\Hydrator;
|
||||||
use Psr\Http\Message\ResponseInterface;
|
use Psr\Http\Message\ResponseInterface;
|
||||||
@ -28,7 +31,7 @@ final class Mailgun
|
|||||||
private $apiKey;
|
private $apiKey;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var HttpMethodsClient
|
* @var HttpClient
|
||||||
*/
|
*/
|
||||||
private $httpClient;
|
private $httpClient;
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ class BatchMessage extends MessageBuilder
|
|||||||
$variables['id'] = $headerName.'_'.$this->counters['recipients'][$headerName];
|
$variables['id'] = $headerName.'_'.$this->counters['recipients'][$headerName];
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->batchRecipientAttributes[(string) $address] = $variables;
|
$this->batchRecipientAttributes[$address] = $variables;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -306,9 +306,9 @@ class MessageBuilder
|
|||||||
throw LimitExceeded::create('campaigns', self::CAMPAIGN_ID_LIMIT);
|
throw LimitExceeded::create('campaigns', self::CAMPAIGN_ID_LIMIT);
|
||||||
}
|
}
|
||||||
if (isset($this->message['o:campaign'])) {
|
if (isset($this->message['o:campaign'])) {
|
||||||
array_push($this->message['o:campaign'], (string) $campaignId);
|
array_push($this->message['o:campaign'], $campaignId);
|
||||||
} else {
|
} else {
|
||||||
$this->message['o:campaign'] = [(string) $campaignId];
|
$this->message['o:campaign'] = [$campaignId];
|
||||||
}
|
}
|
||||||
++$this->counters['attributes']['campaign_id'];
|
++$this->counters['attributes']['campaign_id'];
|
||||||
|
|
||||||
|
@ -28,13 +28,10 @@ final class ConnectionResponse implements ApiResponse
|
|||||||
*/
|
*/
|
||||||
private $requireTLS;
|
private $requireTLS;
|
||||||
|
|
||||||
/**
|
public static function create(array $data): ?self
|
||||||
* @return self
|
|
||||||
*/
|
|
||||||
public static function create(array $data)
|
|
||||||
{
|
{
|
||||||
if (!isset($data['connection'])) {
|
if (!isset($data['connection'])) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
$connSettings = $data['connection'];
|
$connSettings = $data['connection'];
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ final class Event
|
|||||||
private $eventDate;
|
private $eventDate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array|string[]
|
* @var string[]
|
||||||
*/
|
*/
|
||||||
private $tags = [];
|
private $tags = [];
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ final class Event
|
|||||||
private $deliveryStatus;
|
private $deliveryStatus;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array|string[]
|
* @var string[]
|
||||||
*/
|
*/
|
||||||
private $campaigns = [];
|
private $campaigns = [];
|
||||||
|
|
||||||
@ -232,7 +232,7 @@ final class Event
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array|\string[]
|
* @return string[]
|
||||||
*/
|
*/
|
||||||
public function getTags()
|
public function getTags()
|
||||||
{
|
{
|
||||||
@ -240,7 +240,7 @@ final class Event
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array|\string[] $tags
|
* @param string[] $tags
|
||||||
*/
|
*/
|
||||||
private function setTags($tags)
|
private function setTags($tags)
|
||||||
{
|
{
|
||||||
@ -296,7 +296,7 @@ final class Event
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array|\string[]
|
* @return string[]
|
||||||
*/
|
*/
|
||||||
public function getCampaigns()
|
public function getCampaigns()
|
||||||
{
|
{
|
||||||
@ -304,7 +304,7 @@ final class Event
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array|\string[] $campaigns
|
* @param string[] $campaigns
|
||||||
*/
|
*/
|
||||||
private function setCampaigns($campaigns)
|
private function setCampaigns($campaigns)
|
||||||
{
|
{
|
||||||
|
@ -21,49 +21,38 @@ trait PaginationResponse
|
|||||||
*/
|
*/
|
||||||
protected $paging;
|
protected $paging;
|
||||||
|
|
||||||
/**
|
public function getNextUrl(): ?string
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getNextUrl()
|
|
||||||
{
|
{
|
||||||
if (!isset($this->paging['next'])) {
|
if (!isset($this->paging['next'])) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->paging['next'];
|
return $this->paging['next'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
public function getPreviousUrl(): ?string
|
||||||
*/
|
|
||||||
public function getPreviousUrl()
|
|
||||||
{
|
{
|
||||||
if (!isset($this->paging['previous'])) {
|
if (!isset($this->paging['previous'])) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->paging['previous'];
|
return $this->paging['previous'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function getFirstUrl(): ?string
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getFirstUrl()
|
|
||||||
{
|
{
|
||||||
if (!isset($this->paging['first'])) {
|
if (!isset($this->paging['first'])) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->paging['first'];
|
return $this->paging['first'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function getLastUrl(): ?string
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getLastUrl()
|
|
||||||
{
|
{
|
||||||
if (!isset($this->paging['last'])) {
|
if (!isset($this->paging['last'])) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->paging['last'];
|
return $this->paging['last'];
|
||||||
|
@ -24,7 +24,6 @@ final class Action
|
|||||||
/**
|
/**
|
||||||
* Action Named Constructor to build several Action DTOs provided by an Array.
|
* Action Named Constructor to build several Action DTOs provided by an Array.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @return Action[]
|
* @return Action[]
|
||||||
*/
|
*/
|
||||||
public static function createMultiple(array $data)
|
public static function createMultiple(array $data)
|
||||||
@ -38,12 +37,7 @@ final class Action
|
|||||||
return $items;
|
return $items;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private function __construct(string $action)
|
||||||
* Action Private Constructor.
|
|
||||||
*
|
|
||||||
* @param $action
|
|
||||||
*/
|
|
||||||
private function __construct($action)
|
|
||||||
{
|
{
|
||||||
$this->action = $action;
|
$this->action = $action;
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ final class AllResponseItem
|
|||||||
* @param string $id
|
* @param string $id
|
||||||
* @param string $event
|
* @param string $event
|
||||||
* @param string $totalCount
|
* @param string $totalCount
|
||||||
* @param \string[] $tags
|
* @param string[] $tags
|
||||||
*/
|
*/
|
||||||
private function __construct($id, $event, $totalCount, array $tags, \DateTime $createdAt)
|
private function __construct($id, $event, $totalCount, array $tags, \DateTime $createdAt)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user