* Read the Data * @param $option * @return array available options of the data source */
($option)
| 69 | * @return array available options of the data source |
| 70 | */ |
| 71 | public function readData($option): array { |
| 72 | $file = $this->rootFolder->getUserFolder($option['user_id'])->get($option['link']); |
| 73 | $cache = $this->getCacheMetadata($option, $file->getMTime()); |
| 74 | if ($cache['notModified'] === true) { |
| 75 | return [ |
| 76 | 'header' => [], |
| 77 | 'dimensions' => [], |
| 78 | 'data' => [], |
| 79 | 'rawdata' => null, |
| 80 | 'error' => 0, |
| 81 | 'cache' => $cache, |
| 82 | ]; |
| 83 | } |
| 84 | |
| 85 | $rawResult = $file->getContent(); |
| 86 | |
| 87 | $return = $this->jsonParser($option, $rawResult); |
| 88 | $return['rawdata'] = $rawResult; |
| 89 | $return['error'] = 0; |
| 90 | $return['cache'] = $cache; |
| 91 | |
| 92 | return $return; |
| 93 | } |
| 94 | |
| 95 | private function getCacheMetadata(array $option, int $mtime): array { |
| 96 | $currentCacheKey = 'ljson-' . md5($option['link'] . '|' . $mtime); |
nothing calls this directly
no test coverage detected