diff --git a/src/Client/RedmineClient.php b/src/Client/RedmineClient.php index 401b742..9439313 100644 --- a/src/Client/RedmineClient.php +++ b/src/Client/RedmineClient.php @@ -11,23 +11,13 @@ use Symfony\Contracts\Cache\TagAwareCacheInterface; final class RedmineClient { private ?Psr18Client $client = null; - private ?string $url = null; - private ?string $apiKey = null; public function __construct( - private TagAwareCacheInterface $cache + private TagAwareCacheInterface $cache, + private string $url, + private string $apiKey ) {} - public function setUrl(string $url): self - { - $this->url = $url; - } - - public function setApiKey(string $apiKey): self - { - $this->apiKey = $apiKey; - } - public function call(string $api, string $method, array $arguments = []): mixed { $cacheKey = sprintf('%s_%s_%s', $api, $method, sha1(serialize($arguments))); diff --git a/src/Resources/config/services.yaml b/src/Resources/config/services.yaml index ba2676a..09742a3 100644 --- a/src/Resources/config/services.yaml +++ b/src/Resources/config/services.yaml @@ -1,3 +1,3 @@ services: Magdev\RedmineBundle\Client\RedmineClient: - arguments: ['@redmine_api.cache'] + arguments: ['@redmine_api.cache', '%env(REDMINE_URL)%', '%env(REDMINE_APIKEY)%']