Conditions | 4 |
Paths | 4 |
Total Lines | 28 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
20 | public function listOrders($pageIndex = 0, $pageSize = 20) |
||
21 | { |
||
22 | // 't' param is used for cache busting |
||
23 | $parameters = [ |
||
24 | 'page' => max($pageIndex, 0), |
||
25 | 'per_page' => max($pageSize, 1), |
||
26 | 'includes' => [ 'elements' ], |
||
27 | 't' => time() |
||
28 | ]; |
||
29 | |||
30 | $response = $this->query('GET', 'v2/orders/', $parameters); |
||
31 | |||
32 | if ($response->isEmpty()) { |
||
33 | throw new RuntimeException('Response content is empty'); |
||
34 | } |
||
35 | |||
36 | if (! $response->hasProperty('data')) { |
||
37 | throw new RuntimeException('Missing \'data\' property in response'); |
||
38 | } |
||
39 | |||
40 | if (! $response->hasProperty('meta')) { |
||
41 | throw new RuntimeException('Missing \'meta\' property in response'); |
||
42 | } |
||
43 | |||
44 | $meta = $response->getProperty('meta'); |
||
45 | |||
46 | return new OrderList($response->getProperty('data'), $meta->pagination); |
||
|
|||
47 | } |
||
48 | } |
||
49 |
This check looks at variables that are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.