Skip to content

Commit

Permalink
Merge branch 'release/1.3.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Culka committed Mar 25, 2024
2 parents 0cb19cd + 2a4d8d3 commit 3435240
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "trexima/harvey-client",
"description": "Client for Harvey API v2",
"version": "1.3.0",
"version": "1.3.1",
"type": "library",
"license": "MIT",
"authors": [
Expand Down
22 changes: 22 additions & 0 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -1018,4 +1018,26 @@ public function getIscoWorkArea(int $id)
});
return $this->jsonDecode($result);
}

/**
* @param string $school Code of school
* @param array $year
* @return mixed
* @throws \Psr\Cache\InvalidArgumentException
* @throws ReflectionException
*/
public function getSchoolKovByYear(?string $school = null, ?int $year = null)
{
$parameterNames = array_slice($this->methodParameterExtractor->extract(__CLASS__, __FUNCTION__), 0, func_num_args());
$args = array_combine($parameterNames, func_get_args());
$cacheKey = 'search-school-kov-by-year-' . crc32(json_encode([$args]));
$result = $this->cache->get($cacheKey, function (ItemInterface $item) use ($args) {
$item->expiresAfter($this->cacheTtl);
$resource = $this->get('api/school-kov-by-year/' . $args['school'], $args);

return (string)$resource->getBody();
});

return $this->jsonDecode($result);
}
}

0 comments on commit 3435240

Please sign in to comment.