Conditions | 2 |
Paths | 2 |
Total Lines | 16 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 2.024 |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
66 | 45 | public function get($uri, $alt) |
|
67 | { |
||
68 | 45 | $options = ['headers'=> ['Accept' => 'application/xml']]; |
|
69 | |||
70 | 45 | if ($alt == "json") { |
|
71 | $options = ['headers'=> ['Accept' => 'application/json']]; |
||
72 | } |
||
73 | 45 | $uri = $this->endpoint. "/api/". $this->version .$uri."?authtoken=".$this->authToken; |
|
74 | |||
75 | 45 | $response = $this->getClient()->request('GET', $uri, $options); |
|
76 | 45 | $xml = simplexml_load_string($response->getBody()); |
|
77 | 45 | $json = json_encode($xml); |
|
78 | 45 | $data = json_decode($json, true); |
|
79 | |||
80 | 45 | return $data; |
|
81 | } |
||
82 | } |
||
83 |