From 3d9e027f5fcda51476567fc5557325e6f0f954d1 Mon Sep 17 00:00:00 2001 From: Benjamin Kraft Date: Sun, 2 Jun 2024 19:34:40 +0200 Subject: [PATCH] add, remove --- public/elotracker/RiotRequest.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/public/elotracker/RiotRequest.php b/public/elotracker/RiotRequest.php index 915d46c..421142b 100644 --- a/public/elotracker/RiotRequest.php +++ b/public/elotracker/RiotRequest.php @@ -13,9 +13,8 @@ class RiotRequest { public function __construct($endpoint, $isEUNE=false) { $this->endpoint = $endpoint; - $this->isEUNE = $isEUNE; if ($isEUNE){ - $this->host = "https://eun1.api.riotgames.com"; + $this->switchToEUNE(); } } @@ -65,8 +64,7 @@ class RiotRequest { $this->responseCode = intval($matches[1][0]); if ($this->responseCode == 404 && !$this->isEUNE && !$this->usesRouting) { - $this->isEUNE = true; - $this->host = "https://eun1.api.riotgames.com"; + $this->switchToEUNE(); return $this->run($successWithEUNE); } @@ -75,4 +73,9 @@ class RiotRequest { return json_decode($result); } + private function switchToEUNE(): void { + $this->host = "https://eun1.api.riotgames.com"; + $this->isEUNE = true; + } + } \ No newline at end of file