1 | <?php namespace Arcanedev\Stripe; |
||
20 | class Collection extends StripeResource implements CollectionContract |
||
21 | { |
||
22 | /* ------------------------------------------------------------------------------------------------ |
||
23 | | Properties |
||
24 | | ------------------------------------------------------------------------------------------------ |
||
25 | */ |
||
26 | /** @var array */ |
||
27 | protected $requestParams = []; |
||
28 | |||
29 | /* ------------------------------------------------------------------------------------------------ |
||
30 | | Getters & Setters |
||
31 | | ------------------------------------------------------------------------------------------------ |
||
32 | */ |
||
33 | /** |
||
34 | * Set the request parameters. |
||
35 | * |
||
36 | * @param array $params |
||
37 | */ |
||
38 | 98 | public function setRequestParams($params) |
|
42 | |||
43 | /* ------------------------------------------------------------------------------------------------ |
||
44 | | CRUD Functions |
||
45 | | ------------------------------------------------------------------------------------------------ |
||
46 | */ |
||
47 | /** |
||
48 | * List Function. |
||
49 | * |
||
50 | * @param array $params |
||
51 | * @param array|string|null $options |
||
52 | * |
||
53 | * @throws \Arcanedev\Stripe\Exceptions\ApiException |
||
54 | * |
||
55 | * @return self|array |
||
56 | */ |
||
57 | 32 | public function all($params = [], $options = null) |
|
61 | |||
62 | /** |
||
63 | * Create Function. |
||
64 | * |
||
65 | * @param array $params |
||
66 | * @param array|string|null $options |
||
67 | * |
||
68 | * @throws \Arcanedev\Stripe\Exceptions\ApiException |
||
69 | * |
||
70 | * @return \Arcanedev\Stripe\StripeObject|\Arcanedev\Stripe\StripeResource|array |
||
71 | */ |
||
72 | 32 | public function create($params = [], $options = null) |
|
76 | |||
77 | /** |
||
78 | * Retrieve Function. |
||
79 | * |
||
80 | * @param string $id |
||
81 | * @param array $params |
||
82 | * @param array|string|null $options |
||
83 | * |
||
84 | * @throws \Arcanedev\Stripe\Exceptions\ApiException |
||
85 | * |
||
86 | * @return \Arcanedev\Stripe\StripeObject|\Arcanedev\Stripe\StripeResource|array |
||
87 | */ |
||
88 | 12 | public function retrieve($id, $params = [], $options = null) |
|
97 | |||
98 | /** |
||
99 | * Make a request and convert to Stripe object. |
||
100 | * |
||
101 | * @param string $method |
||
102 | * @param array $params |
||
103 | * @param array|string|null $options |
||
104 | * |
||
105 | * @return self|\Arcanedev\Stripe\StripeObject|\Arcanedev\Stripe\StripeResource|array| |
||
106 | */ |
||
107 | 46 | private function requestAndConvertToStripeObject($method, $params, $options) |
|
116 | |||
117 | /** |
||
118 | * Get An iterator that can be used to iterate across all objects across all pages. |
||
119 | * As page boundaries are encountered, the next page will be fetched automatically |
||
120 | * for continued iteration. |
||
121 | * |
||
122 | * @return \Arcanedev\Stripe\Utilities\AutoPagingIterator |
||
123 | */ |
||
124 | 6 | public function autoPagingIterator() |
|
128 | |||
129 | /* ------------------------------------------------------------------------------------------------ |
||
130 | | Check Functions |
||
131 | | ------------------------------------------------------------------------------------------------ |
||
132 | */ |
||
133 | /** |
||
134 | * Check if Object is list. |
||
135 | * |
||
136 | * @return bool |
||
137 | */ |
||
138 | 28 | public function isList() |
|
142 | |||
143 | /** |
||
144 | * Check if URL has path. |
||
145 | * |
||
146 | * @param array $url |
||
147 | * |
||
148 | * @throws \Arcanedev\Stripe\Exceptions\ApiException |
||
149 | */ |
||
150 | 46 | private function checkPath(array $url) |
|
155 | |||
156 | /* ------------------------------------------------------------------------------------------------ |
||
157 | | Other Functions |
||
158 | | ------------------------------------------------------------------------------------------------ |
||
159 | */ |
||
160 | /** |
||
161 | * Get items count. |
||
162 | * |
||
163 | * @return int |
||
164 | */ |
||
165 | 10 | public function count() |
|
169 | |||
170 | /** |
||
171 | * Extract Path And Update Parameters. |
||
172 | * |
||
173 | * @param array|null $params |
||
174 | * |
||
175 | * @return array |
||
176 | */ |
||
177 | 46 | private function extractPathAndUpdateParams($params) |
|
197 | } |
||
198 |