Issues (236)

src/pay/pay.php (3 issues)

Labels
Severity
1
<?php
2
3
namespace BPT\pay;
4
5
use BPT\settings;
6
7
class pay {
8
    public static function init (): void {
9
        if (isset(settings::$pay['crypto'])) {
10
            $settings = [
11
                'api_key'       => settings::$pay['crypto']['api_key'] ?? null,
12
                'ipn_secret'    => settings::$pay['crypto']['ipn_secret'] ?? null,
13
                'round_decimal' => settings::$pay['crypto']['round_decimal'] ?? null,
14
            ];
15
            crypto::init(...array_filter($settings));
0 ignored issues
show
array_filter($settings) is expanded, but the parameter $api_key of BPT\pay\crypto::init() 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

15
            crypto::init(/** @scrutinizer ignore-type */ ...array_filter($settings));
Loading history...
16
        }
17
        if (isset(settings::$pay['idpay'])) {
18
            $settings = [
19
                'api_key' => settings::$pay['idpay']['api_key'] ?? null,
20
                'sandbox' => settings::$pay['idpay']['sandbox'] ?? null,
21
            ];
22
            idpay::init(...array_filter($settings));
0 ignored issues
show
array_filter($settings) is expanded, but the parameter $api_key of BPT\pay\idpay::init() 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

22
            idpay::init(/** @scrutinizer ignore-type */ ...array_filter($settings));
Loading history...
23
        }
24
        if (isset(settings::$pay['zarinpal'])) {
25
            $settings = [
26
                'merchant_id' => settings::$pay['zarinpal']['sandbox'] ?? null,
27
                'sandbox'     => settings::$pay['zarinpal']['zarin_gate'] ?? settings::$pay['zarinpal']['zaringate'] ?? null,
28
                'zarin_gate'  => settings::$pay['zarinpal']['merchant_id'] ?? null,
29
            ];
30
            zarinpal::init(...array_filter($settings));
0 ignored issues
show
array_filter($settings) is expanded, but the parameter $merchant_id of BPT\pay\zarinpal::init() 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

30
            zarinpal::init(/** @scrutinizer ignore-type */ ...array_filter($settings));
Loading history...
31
        }
32
    }
33
}