From 1044a648f0e94f330331b37f512a7d368c3ae2a3 Mon Sep 17 00:00:00 2001 From: Artem Bondarenko Date: Fri, 16 Oct 2020 22:33:46 +0300 Subject: [PATCH] removed optional --- src/Api/Suppression/Whitelist.php | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/Api/Suppression/Whitelist.php b/src/Api/Suppression/Whitelist.php index 5c8e54b..0581c3a 100644 --- a/src/Api/Suppression/Whitelist.php +++ b/src/Api/Suppression/Whitelist.php @@ -70,15 +70,16 @@ class Whitelist extends HttpApi /** * @param string $domain Domain to create whitelist for * @param string $address whitelist email address or domain name - * @param array $params optional * * @return CreateResponse */ - public function create(string $domain, string $address, array $params = []) + public function create(string $domain, string $address) { Assert::stringNotEmpty($domain); Assert::stringNotEmpty($address); + $params = []; + if (false !== filter_var($address, FILTER_VALIDATE_EMAIL)) { $params['address'] = $address; } elseif (false !== filter_var($address, FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)) { @@ -95,11 +96,10 @@ class Whitelist extends HttpApi /** * @param string $domain Domain to create whitelist for * @param string $filePath csv file path - * @param array $params optional * * @return ImportResponse */ - public function import(string $domain, string $filePath, array $params = []) + public function import(string $domain, string $filePath) { Assert::stringNotEmpty($domain); Assert::stringNotEmpty($filePath); @@ -108,9 +108,9 @@ class Whitelist extends HttpApi $response = $this->httpPost( sprintf('/v3/%s/whitelists/import', $domain), ['file' => fopen($filePath, 'r')], - array_merge($params, [ + [ 'filename' => basename($filePath), - ]) + ] ); return $this->hydrateResponse($response, ImportResponse::class); @@ -119,16 +119,15 @@ class Whitelist extends HttpApi /** * @param string $domain Domain to delete whitelist for * @param string $address whitelist address - * @param array $params optional * * @return DeleteResponse */ - public function delete(string $domain, string $address, array $params = []) + public function delete(string $domain, string $address) { Assert::stringNotEmpty($domain); Assert::stringNotEmpty($address); - $response = $this->httpDelete(sprintf('/v3/%s/whitelists/%s', $domain, $address), $params); + $response = $this->httpDelete(sprintf('/v3/%s/whitelists/%s', $domain, $address)); return $this->hydrateResponse($response, DeleteResponse::class); }