PaymentDraftBuilder::schedule()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
namespace tbclla\Revolut\Builders;
4
5
class PaymentDraftBuilder extends Builder
6
{
7
    /**
8
     * An optional title
9
     *
10
     * @var string
11
     */
12
    public $title;
13
14
    /**
15
     * An optional future date
16
     *
17
     * @var string
18
     */
19
    public $schedule_for;
20
21
    /**
22
     * The payments included in the draft
23
     *
24
     * @var array
25
     */
26
    public $payments;
27
28
    /**
29
     * Set an optional title for the draft
30
     *
31
     * @param string $title
32
     * @return self
33
     */
34
    public function title(string $title)
35
    {
36
        return $this->setAttribute('title', $title);
37
    }
38
39
    /**
40
     * Set an optional future date to schedule the payments
41
     *
42
     * @param string $date
43
     * @return self
44
     */
45
    public function schedule(string $date)
46
    {
47
        return $this->setAttribute('schedule_for', $date);
48
    }
49
50
    /**
51
     * Set the payments included in the draft
52
     *
53
     * @param array $payments
54
     * @return self
55
     */
56
    public function payments(array $payments)
57
    {
58
        return $this->setAttribute('payments', $payments);
59
    }
60
61
    /**
62
     * Add a payment to the draft
63
     *
64
     * @param array $payment
65
     * @return self
66
     */
67
    public function addPayment(array $payment)
68
    {
69
        return $this->payments(array_merge($this->payments ?? [], $payment));
70
    }
71
}
72