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

easyPay   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 15
c 1
b 0
f 0
dl 0
loc 29
rs 10
wmc 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setZarinpal() 0 6 3
A setCrypto() 0 6 3
A getSettings() 0 2 1
A setIdpay() 0 6 3
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
}