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