1 | <?php |
||
16 | class Transaction |
||
17 | { |
||
18 | /** |
||
19 | * @var |
||
20 | */ |
||
21 | private $from, $to, $value, $currency, $to_params, $token, $fee, $from_params, $saved_customer; |
||
|
|||
22 | |||
23 | /** |
||
24 | * Transaction constructor. |
||
25 | * @param null $token |
||
26 | */ |
||
27 | public function __construct($token = null) |
||
31 | |||
32 | /** |
||
33 | * Set the Customer. |
||
34 | * |
||
35 | * @param $user |
||
36 | * @param array $params |
||
37 | * @return $this |
||
38 | */ |
||
39 | public function from($user, $params = []) |
||
45 | |||
46 | /** |
||
47 | * @return $this |
||
48 | */ |
||
49 | public function useSavedCustomer() |
||
54 | |||
55 | /** |
||
56 | * Set the Vendor. |
||
57 | * |
||
58 | * @param $user |
||
59 | * @param array $params |
||
60 | * @return $this |
||
61 | */ |
||
62 | public function to($user, $params = []) |
||
68 | |||
69 | /** |
||
70 | * The amount of the transaction. |
||
71 | * |
||
72 | * @param $value |
||
73 | * @param $currency |
||
74 | * @return $this |
||
75 | */ |
||
76 | public function amount($value, $currency) |
||
82 | |||
83 | /** |
||
84 | * Take your fees here. |
||
85 | * |
||
86 | * @param $amount |
||
87 | * @return $this |
||
88 | */ |
||
89 | public function fee($amount) |
||
94 | |||
95 | /** |
||
96 | * Create the transaction: charge customer and credit vendor. |
||
97 | * This function saves the two accounts. |
||
98 | * |
||
99 | * @param array $params |
||
100 | * @return Charge |
||
101 | */ |
||
102 | public function create($params = []) |
||
123 | } |
Only declaring a single property per statement allows you to later on add doc comments more easily.
It is also recommended by PSR2, so it is a common style that many people expect.