Conditions | 4 |
Paths | 6 |
Total Lines | 39 |
Code Lines | 25 |
Lines | 0 |
Ratio | 0 % |
Tests | 22 |
CRAP Score | 4.0582 |
Changes | 0 |
1 | <?php |
||
25 | 2 | public function toArray(): array |
|
26 | { |
||
27 | 2 | $request = []; |
|
28 | |||
29 | 2 | if ($this->productDescription ?? null) { |
|
30 | $request[] = [ |
||
31 | 'op' => 'replace', |
||
32 | 'path' => '/description', |
||
33 | 'value' => $this->productDescription |
||
34 | ]; |
||
35 | } |
||
36 | |||
37 | 2 | if ($this->paymentPreferences ?? null) { |
|
38 | 2 | $request[] = [ |
|
39 | 2 | 'op' => 'replace', |
|
40 | 2 | 'path' => '/payment_preferences/auto_bill_outstanding', |
|
41 | 2 | 'value' => $this->paymentPreferences->isAutoBillOutstanding() |
|
42 | ]; |
||
43 | 2 | $request[] = [ |
|
44 | 2 | 'op' => 'replace', |
|
45 | 2 | 'path' => '/payment_preferences/payment_failure_threshold', |
|
46 | 2 | 'value' => $this->paymentPreferences->getPaymentFailureThreshold() |
|
47 | ]; |
||
48 | 2 | $request[] = [ |
|
49 | 2 | 'op' => 'replace', |
|
50 | 2 | 'path' => '/payment_preferences/setup_fee_failure_action', |
|
51 | 2 | 'value' => $this->paymentPreferences->getSetupFeeFailureAction() |
|
52 | ]; |
||
53 | |||
54 | 2 | if ($this->paymentPreferences->getSetupFee()) { |
|
55 | 1 | $request[] = [ |
|
56 | 1 | 'op' => 'replace', |
|
57 | 1 | 'path' => '/payment_preferences/setup_fee', |
|
58 | 1 | 'value' => $this->paymentPreferences->getSetupFee()->toArray() |
|
59 | ]; |
||
60 | } |
||
61 | } |
||
62 | |||
63 | 2 | return $request; |
|
64 | } |
||
66 |