Passed
Push — main ( f82312...487838 )
by Miaad
10:48 queued 13s
created

easyPay::setZarinpal()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 4
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 6
rs 10
1
<?php
2
3
namespace BPT\settings;
4
class easyPay {
5
    private array $settings = [];
6
7
    public function setCrypto (array|easyCrypto $crypto): self {
8
        if (!is_array($crypto) && !empty($crypto)) {
0 ignored issues
show
introduced by
The condition is_array($crypto) is always true.
Loading history...
9
            $crypto = $crypto->getSettings();
10
        }
11
        $this->settings['crypto'] = $crypto;
12
        return $this;
13
    }
14
15
    public function setIdpay (array|easyIdpay $idpay): self {
16
        if (!is_array($idpay) && !empty($idpay)) {
0 ignored issues
show
introduced by
The condition is_array($idpay) is always true.
Loading history...
17
            $idpay = $idpay->getSettings();
18
        }
19
        $this->settings['idpay'] = $idpay;
20
        return $this;
21
    }
22
23
    public function setZarinpal (array|easyZarinpal $zarinpal): self {
24
        if (!is_array($zarinpal) && !empty($zarinpal)) {
0 ignored issues
show
introduced by
The condition is_array($zarinpal) is always true.
Loading history...
25
            $zarinpal = $zarinpal->getSettings();
26
        }
27
        $this->settings['zarinpal'] = $zarinpal;
28
        return $this;
29
    }
30
31
    public function getSettings (): array {
32
        return $this->settings;
33
    }
34
}