Conditions | 2 |
Paths | 2 |
Total Lines | 28 |
Code Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
27 | public function get($name = '', $options = []) |
||
28 | { |
||
29 | $defaultOptions = [ |
||
30 | 'status' => 'active', |
||
31 | 'page' => 1, |
||
32 | 'per_page' => 20, |
||
33 | 'order' => 'status', |
||
34 | 'direction' => 'asc', |
||
35 | 'match' => 'all', |
||
36 | ]; |
||
37 | |||
38 | $newOptions = [ |
||
39 | 'name' => $name |
||
40 | ]; |
||
41 | |||
42 | $newOptions = array_merge($newOptions, $defaultOptions, $options); |
||
43 | |||
44 | $string = "?"; |
||
45 | foreach ($newOptions as $k => $v) { |
||
46 | $string .= $k . '=' . $v . '&'; |
||
47 | } |
||
48 | |||
49 | //Remove the last '&' |
||
50 | $string = substr($string, 0, -1); |
||
51 | |||
52 | $this->makeRequest($this->URL . $string); |
||
53 | return $this->getResponse(); |
||
54 | } |
||
55 | } |
||
56 |