Skip to content

Commit 48610ca

Browse files
committed
remove-php-8-4] cleanup phpdoc comments
1 parent f01ce63 commit 48610ca

File tree

6 files changed

+40
-48
lines changed

6 files changed

+40
-48
lines changed

src/Exceptions/UnzerApiException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class UnzerApiException extends Exception
2626
*
2727
* @param string $merchantMessage
2828
* @param string $clientMessage
29-
* @param string $code
29+
* @param string|null $code
3030
* @param string|null $errorId
3131
*/
3232
public function __construct($merchantMessage = '', $clientMessage = '', $code = null, ?string $errorId = null)

src/Resources/EmbeddedResources/GooglePay/SignedMessage.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,6 @@ class SignedMessage extends AbstractUnzerResource
1515
/** @var string */
1616
protected $encryptedMessage;
1717

18-
/**
19-
* @param string $tag
20-
* @param string $ephemeralPublicKey
21-
* @param string $encryptedMessage
22-
*/
2318
public function __construct(?string $tag = null, ?string $ephemeralPublicKey = null, ?string $encryptedMessage = null)
2419
{
2520
$this->tag = $tag;

src/Resources/TransactionTypes/Payout.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,6 @@ class Payout extends AbstractTransactionType
2424
/** @var string $paymentReference */
2525
protected $paymentReference;
2626

27-
/**
28-
* Payout constructor.
29-
*
30-
* @param float|null $amount
31-
* @param string|null $currency
32-
* @param null $returnUrl
33-
*/
3427
public function __construct(?float $amount = null, ?string $currency = null, $returnUrl = null)
3528
{
3629
$this->setAmount($amount);

src/Services/HttpService.php

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
* This service provides for functionalities concerning http transactions.
1919
*
2020
* @link https://docs.unzer.com/
21-
*
2221
*/
2322
class HttpService
2423
{
@@ -82,26 +81,26 @@ public function setEnvironmentService(EnvironmentService $environmentService): H
8281
}
8382

8483
/**
85-
* @deprecated use sendRequest() instead.
86-
*
8784
* send post request to payment server
8885
*
89-
* @param $uri string|null uri of the target system
86+
* @param string|null $uri uri of the target system
9087
* @param ?AbstractUnzerResource $resource
91-
* @param string $httpMethod
92-
* @param string $apiVersion
88+
* @param string|null $httpMethod
89+
* @param string|null $apiVersion
9390
*
9491
* @return string
9592
*
9693
* @throws UnzerApiException An UnzerApiException is thrown if there is an error returned on API-request.
9794
* @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK.
95+
* @deprecated use sendRequest() instead.
9896
*/
9997
public function send(
10098
?string $uri = null,
10199
?AbstractUnzerResource $resource = null,
102100
string $httpMethod = HttpAdapterInterface::REQUEST_GET,
103101
?string $apiVersion = null
104-
): string {
102+
): string
103+
{
105104
if (!$resource instanceof AbstractUnzerResource) {
106105
throw new RuntimeException('Transfer object is empty!');
107106
}
@@ -116,14 +115,14 @@ public function send(
116115
* send post request to payment server
117116
*
118117
* @param ApiRequest $request
118+
*
119119
* @return string
120120
*
121121
* @throws UnzerApiException An UnzerApiException is thrown if there is an error returned on API-request.
122122
* @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK.
123123
*/
124-
public function sendRequest(
125-
ApiRequest $request
126-
): string {
124+
public function sendRequest(ApiRequest $request): string
125+
{
127126
$unzerObj = $request->getResource()->getUnzerObject();
128127

129128
$apiConfig = $request->getResource()->getApiConfig();
@@ -137,8 +136,8 @@ public function sendRequest(
137136
$headers = $this->composeHttpHeaders($unzerObj, $apiConfig::getAuthorizationMethod());
138137
$httpMethod = $request->getHttpMethod();
139138
$this->initRequest($requestUrl, $payload, $httpMethod, $headers);
140-
$httpAdapter = $this->getAdapter();
141-
$response = $httpAdapter->execute();
139+
$httpAdapter = $this->getAdapter();
140+
$response = $httpAdapter->execute();
142141
$responseCode = $httpAdapter->getResponseCode();
143142
$httpAdapter->close();
144143

@@ -158,7 +157,7 @@ public function sendRequest(
158157
* @param string $uri
159158
* @param string $payload
160159
* @param string $httpMethod
161-
* @param array $httpHeaders
160+
* @param array $httpHeaders
162161
*
163162
* @throws RuntimeException
164163
*/
@@ -174,7 +173,7 @@ private function initRequest(string $uri, string $payload, string $httpMethod, a
174173
* Handles error responses by throwing an UnzerApiException with the returned messages and error code.
175174
* Returns doing nothing if no error occurred.
176175
*
177-
* @param string $responseCode
176+
* @param string $responseCode
178177
* @param string|null $response
179178
*
180179
* @throws UnzerApiException
@@ -187,15 +186,15 @@ private function handleErrors(string $responseCode, ?string $response): void
187186

188187
$responseObject = json_decode($response, false);
189188
if (!is_numeric($responseCode) || (int)$responseCode >= 400 || isset($responseObject->errors)) {
190-
$code = null;
191-
$errorId = null;
189+
$code = null;
190+
$errorId = null;
192191
$customerMessage = $code;
193192
$merchantMessage = $customerMessage;
194193
if (isset($responseObject->errors[0])) {
195-
$errors = $responseObject->errors[0];
194+
$errors = $responseObject->errors[0];
196195
$merchantMessage = $errors->merchantMessage ?? '';
197196
$customerMessage = $errors->customerMessage ?? '';
198-
$code = $errors->code ?? '';
197+
$code = $errors->code ?? '';
199198
}
200199
if (isset($responseObject->id)) {
201200
$errorId = $responseObject->id;
@@ -209,23 +208,24 @@ private function handleErrors(string $responseCode, ?string $response): void
209208
}
210209

211210
/**
212-
* @param Unzer $unzerObj
213-
* @param string $payload
214-
* @param mixed $headers
215-
* @param string $responseCode
216-
* @param string $httpMethod
217-
* @param string $url
211+
* @param Unzer $unzerObj
212+
* @param string $payload
213+
* @param mixed $headers
214+
* @param string $responseCode
215+
* @param string $httpMethod
216+
* @param string $url
218217
* @param string|null $response
219218
*/
220219
public function debugLog(
221220
Unzer $unzerObj,
222221
string $payload,
223-
$headers,
224-
string $responseCode,
222+
$headers,
223+
string $responseCode,
225224
string $httpMethod,
226225
string $url,
227226
?string $response
228-
): void {
227+
): void
228+
{
229229
// mask auth string
230230
$authHeader = explode(' ', $headers['Authorization']);
231231
$authHeader[1] = ValueService::maskValue($authHeader[1]);
@@ -275,16 +275,16 @@ private function buildRequestUrl(ApiRequest $request): string
275275
*/
276276
public function composeHttpHeaders(Unzer $unzer, string $authorizationMethod = AuthorizationMethods::BASIC): array
277277
{
278-
$locale = $unzer->getLocale();
279-
$clientIp = $unzer->getClientIp();
280-
$key = $unzer->getKey();
278+
$locale = $unzer->getLocale();
279+
$clientIp = $unzer->getClientIp();
280+
$key = $unzer->getKey();
281281

282282
$httpHeaders = [
283283
'Authorization' => $this->findAuthentication($unzer, $authorizationMethod),
284-
'Content-Type' => 'application/json',
285-
'SDK-VERSION' => Unzer::SDK_VERSION,
286-
'SDK-TYPE' => Unzer::SDK_TYPE,
287-
'PHP-VERSION' => PHP_VERSION
284+
'Content-Type' => 'application/json',
285+
'SDK-VERSION' => Unzer::SDK_VERSION,
286+
'SDK-TYPE' => Unzer::SDK_TYPE,
287+
'PHP-VERSION' => PHP_VERSION
288288
];
289289
if (!empty($locale)) {
290290
$httpHeaders['Accept-Language'] = $locale;
@@ -347,6 +347,7 @@ public function isApiConfig($className): bool
347347

348348
/**
349349
* @param Unzer $unzer
350+
*
350351
* @return string
351352
*/
352353
private function findAuthentication(Unzer $unzer, string $authorizationMethod = AuthorizationMethods::BASIC): string

src/Services/PaymentService.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ public function getResourceService(): ResourceService
7373
return $this->getUnzer()->getResourceService();
7474
}
7575

76+
/**
77+
* {@inheritDoc}
78+
*/
7679
public function performAuthorization(
7780
Authorization $authorization,
7881
$paymentType,

src/Services/ResourceService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ public function deleteResource(AbstractUnzerResource &$resource): ?AbstractUnzer
338338
* Updates the given local resource object (id must be set)
339339
*
340340
* @param AbstractUnzerResource $resource The local resource object to update.
341-
* @param string $apiVersion
341+
* @param string|null $apiVersion
342342
*
343343
* @return AbstractUnzerResource The updated resource object.
344344
*

0 commit comments

Comments
 (0)