Webhook::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 0
c 2
b 0
f 0
nc 1
nop 1
dl 0
loc 2
ccs 1
cts 1
cp 1
crap 1
rs 10
1
<?php
2
3
namespace Sebdesign\VivaPayments;
4
5
use Sebdesign\VivaPayments\Responses\WebhookVerificationKey;
6
7
class Webhook
8
{
9 3
    public function __construct(protected Client $client)
10
    {
11
    }
12
13
    /**
14
     * Get a webhook authorization code.
15
     *
16
     * @see https://developer.vivawallet.com/webhooks-for-payments/#generate-a-webhook-verification-key
17
     *
18
     * @param  array<string,mixed>  $guzzleOptions  Additional parameters for the Guzzle client
19
     */
20 6
    public function getVerificationKey(array $guzzleOptions = []): WebhookVerificationKey
21
    {
22 6
        $response = $this->client->get(
23 6
            $this->client->getUrl()->withPath('/api/messages/config/token'),
24 6
            array_merge_recursive(
25 6
                $this->client->authenticateWithBasicAuth(),
26
                $guzzleOptions
27
            )
28
        );
29
30
        /** @phpstan-ignore-next-line */
31 6
        return new WebhookVerificationKey(...$response);
0 ignored issues
show
Bug introduced by
$response is expanded, but the parameter $Key of Sebdesign\VivaPayments\R...ationKey::__construct() does not expect variable arguments. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

31
        return new WebhookVerificationKey(/** @scrutinizer ignore-type */ ...$response);
Loading history...
32
    }
33
}
34