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

Method getJsonData

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

Source from the content-addressed store, hash-verified

381 }
382
383 private function getJsonData($url, $option) {
384 $headers = [
385 'User-Agent' => 'Analytics for Nextcloud',
386 'Accept' => 'application/vnd.github.v3+json',
387 ];
388 if (isset($option['token']) && $option['token'] !== '') {
389 $headers['Authorization'] = 'token ' . $option['token'];
390 }
391 $response = $this->httpClient->request($url, 'GET', $headers);
392 $data = json_decode($response['body'], true);
393 return [
394 'data' => is_array($data) ? $data : [],
395 'http_code' => $response['status'],
396 'request_error' => $response['error'],
397 ];
398 }
399
400 private function floatvalue($val) {
401 $val = str_replace(",", ".", $val);

Callers 1

readDataMethod · 0.95

Calls 1

requestMethod · 0.45

Tested by

no test coverage detected