diff --git a/src/FKSDBDownloader.php b/src/FKSDBDownloader.php index f59087c..173cc4a 100644 --- a/src/FKSDBDownloader.php +++ b/src/FKSDBDownloader.php @@ -88,7 +88,7 @@ public function downloadJSON(Request $request): string ); restore_error_handler(); if ($result === false) { - $result = error_get_last(); + $result = error_get_last()['message']; } return $result; } diff --git a/src/Requests/SeriesResultsRequest.php b/src/Requests/SeriesResultsRequest.php new file mode 100644 index 0000000..a5df201 --- /dev/null +++ b/src/Requests/SeriesResultsRequest.php @@ -0,0 +1,38 @@ +contestId = $contestId; + $this->year = $year; + $this->series = $series; + } + + public function getMethod(): string + { + return 'GetSeriesResults'; + } + + public function getParams(): array + { + return [ + 'contestId' => $this->contestId, + 'year' => $this->year, + 'series' => $this->series, + ]; + } + + public function getCacheKey(): string + { + return sprintf('series.results.%s.%s.%s', $this->contestId, $this->year, $this->series); + } +} diff --git a/src/Requests/StatsRequest.php b/src/Requests/StatsRequest.php new file mode 100644 index 0000000..d884d04 --- /dev/null +++ b/src/Requests/StatsRequest.php @@ -0,0 +1,35 @@ +contestId = $contestId; + $this->year = $year; + } + + public function getMethod(): string + { + return 'GetStats'; + } + + public function getParams(): array + { + return [ + 'contestId' => $this->contestId, + 'year' => $this->year, + ]; + } + + public function getCacheKey(): string + { + return sprintf('task.stats.%s.%s', $this->contestId, $this->year); + } +}