MCPcopy Create free account
hub / github.com/Rello/analytics / getJsonData

Method getJsonData

lib/Datasource/Github.php:370–385  ·  view source on GitHub ↗
($url, $option)

Source from the content-addressed store, hash-verified

368 }
369
370 private function getJsonData($url, $option) {
371 $headers = [
372 'User-Agent' => 'Analytics for Nextcloud',
373 'Accept' => 'application/vnd.github.v3+json',
374 ];
375 if (isset($option['token']) && $option['token'] !== '') {
376 $headers['Authorization'] = 'token ' . $option['token'];
377 }
378 $response = $this->httpClient->request($url, 'GET', $headers);
379 $data = json_decode($response['body'], true);
380 return [
381 'data' => is_array($data) ? $data : [],
382 'http_code' => $response['status'],
383 'request_error' => $response['error'],
384 ];
385 }
386
387 private function floatvalue($val) {
388 $val = str_replace(",", ".", $val);

Callers 1

readDataMethod · 0.95

Calls 1

requestMethod · 0.45

Tested by

no test coverage detected