add, remove

main
Benjamin Kraft 4 months ago
parent 4a4b5385a7
commit 3d9e027f5f
  1. 11
      public/elotracker/RiotRequest.php

@ -13,9 +13,8 @@ class RiotRequest {
public function __construct($endpoint, $isEUNE=false) { public function __construct($endpoint, $isEUNE=false) {
$this->endpoint = $endpoint; $this->endpoint = $endpoint;
$this->isEUNE = $isEUNE;
if ($isEUNE){ if ($isEUNE){
$this->host = "https://eun1.api.riotgames.com"; $this->switchToEUNE();
} }
} }
@ -65,8 +64,7 @@ class RiotRequest {
$this->responseCode = intval($matches[1][0]); $this->responseCode = intval($matches[1][0]);
if ($this->responseCode == 404 && !$this->isEUNE && !$this->usesRouting) { if ($this->responseCode == 404 && !$this->isEUNE && !$this->usesRouting) {
$this->isEUNE = true; $this->switchToEUNE();
$this->host = "https://eun1.api.riotgames.com";
return $this->run($successWithEUNE); return $this->run($successWithEUNE);
} }
@ -75,4 +73,9 @@ class RiotRequest {
return json_decode($result); return json_decode($result);
} }
private function switchToEUNE(): void {
$this->host = "https://eun1.api.riotgames.com";
$this->isEUNE = true;
}
} }
Loading…
Cancel
Save