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