1 | <?php namespace Arcanedev\Stripe\Resources; |
||
29 | class Transfer extends StripeResource implements TransferContract |
||
30 | { |
||
31 | /* ------------------------------------------------------------------------------------------------ |
||
32 | | Main Functions |
||
33 | | ------------------------------------------------------------------------------------------------ |
||
34 | */ |
||
35 | /** |
||
36 | * List all Transfers. |
||
37 | * @link https://stripe.com/docs/api/php#list_transfers |
||
38 | * |
||
39 | * @param array|null $params |
||
40 | * @param array|string|null $options |
||
41 | * |
||
42 | * @return \Arcanedev\Stripe\Collection|array |
||
43 | */ |
||
44 | 2 | public static function all($params = [], $options = null) |
|
48 | |||
49 | /** |
||
50 | * Retrieve a Transfer. |
||
51 | * @link https://stripe.com/docs/api/php#retrieve_transfer |
||
52 | * |
||
53 | * @param string $id |
||
54 | * @param array|string|null $options |
||
55 | * |
||
56 | * @return self |
||
57 | */ |
||
58 | 6 | public static function retrieve($id, $options = null) |
|
62 | |||
63 | /** |
||
64 | * Create a transfer. |
||
65 | * @link https://stripe.com/docs/api/php#create_transfer |
||
66 | * |
||
67 | * @param array|null $params |
||
68 | * @param array|string|null $options |
||
69 | * |
||
70 | * @return self|array |
||
71 | */ |
||
72 | 10 | public static function create($params = [], $options = null) |
|
76 | |||
77 | /** |
||
78 | * Update a Transfer. |
||
79 | * @link https://stripe.com/docs/api/php#update_transfer |
||
80 | * |
||
81 | * @param string $id |
||
82 | * @param array|null $params |
||
83 | * @param array|string|null $options |
||
84 | * |
||
85 | * @return self |
||
86 | */ |
||
87 | public static function update($id, $params = [], $options = null) |
||
91 | |||
92 | /** |
||
93 | * Update/Save a Transfer. |
||
94 | * @link https://stripe.com/docs/api/php#update_transfer |
||
95 | * |
||
96 | * @param array|string|null $options |
||
97 | * |
||
98 | * @return self |
||
99 | */ |
||
100 | 4 | public function save($options = null) |
|
104 | |||
105 | /** |
||
106 | * Cancel a Transfer. |
||
107 | * @link https://stripe.com/docs/api/php#cancel_transfer |
||
108 | * |
||
109 | * @return self |
||
110 | */ |
||
111 | public function cancel() |
||
118 | |||
119 | /** |
||
120 | * Created transfer reversal. |
||
121 | * |
||
122 | * @param array|null $params |
||
123 | * @param array|string|null $options |
||
124 | * |
||
125 | * @return \Arcanedev\Stripe\Resources\TransferReversal |
||
126 | */ |
||
127 | public function reverse($params = [], $options = null) |
||
136 | } |
||
137 |
If you return a value from a function or method, it should be a sub-type of the type that is given by the parent type f.e. an interface, or abstract method. This is more formally defined by the Lizkov substitution principle, and guarantees that classes that depend on the parent type can use any instance of a child type interchangably. This principle also belongs to the SOLID principles for object oriented design.
Let’s take a look at an example:
Our function
my_function
expects aPost
object, and outputs the author of the post. The base classPost
returns a simple string and outputting a simple string will work just fine. However, the child classBlogPost
which is a sub-type ofPost
instead decided to return anobject
, and is therefore violating the SOLID principles. If aBlogPost
were passed tomy_function
, PHP would not complain, but ultimately fail when executing thestrtoupper
call in its body.