throw arguments into closure

This commit is contained in:
2024-09-13 02:55:59 +02:00
parent d22997f2f9
commit 0eaddfd7e1

View File

@@ -22,12 +22,11 @@ final class RedmineClient
{ {
$cacheKey = sprintf('%s_%s_%s', $api, $method, sha1(serialize($arguments))); $cacheKey = sprintf('%s_%s_%s', $api, $method, sha1(serialize($arguments)));
return $this->cache->get($cacheKey, function (ItemInterface $item) use ($api, $method): array { return $this->cache->get($cacheKey, function (ItemInterface $item) use ($api, $method, $arguments): array {
$item->expiresAfter(3600); $item->expiresAfter(3600);
$item->tag([$api, $method]); $item->tag([$api, $method]);
$client = $this->getClient()->getApi($api); $client = $this->getClient()->getApi($api);
$arguments = is_array($arguments) ? $arguments : [];
$value = \call_user_func_array([$client, $method], $arguments); $value = \call_user_func_array([$client, $method], $arguments);
return $value; return $value;