| @@ 160-179 (lines=20) @@ | ||
| 157 | } |
|
| 158 | } |
|
| 159 | ||
| 160 | private function getCharacterDetails($charID, $retries = 3) |
|
| 161 | { |
|
| 162 | if (isset($this->characterCache[$charID])) { |
|
| 163 | return $this->characterCache[$charID]; |
|
| 164 | } |
|
| 165 | $character = null; |
|
| 166 | for ($i = 0; $i < $retries; $i++) { |
|
| 167 | $character = characterDetails($charID); |
|
| 168 | if (!is_null($character)) { |
|
| 169 | break; |
|
| 170 | } |
|
| 171 | } |
|
| 172 | if (!$character || isset($character['error'])) { |
|
| 173 | $this->logger->addInfo('AuthCheck: characterDetails lookup failed.'); |
|
| 174 | $msg = isset($character['error']) ? $character['error'] : 'characterDetails lookup failed'; |
|
| 175 | throw new Exception($msg); |
|
| 176 | } |
|
| 177 | $this->characterCache[$charID] = $character; |
|
| 178 | return $character; |
|
| 179 | } |
|
| 180 | ||
| 181 | private function getCorpDetails($corpID, $retries = 3) |
|
| 182 | { |
|
| @@ 181-200 (lines=20) @@ | ||
| 178 | return $character; |
|
| 179 | } |
|
| 180 | ||
| 181 | private function getCorpDetails($corpID, $retries = 3) |
|
| 182 | { |
|
| 183 | if (isset($this->corpCache[$corpID])) { |
|
| 184 | return $this->corpCache[$corpID]; |
|
| 185 | } |
|
| 186 | $corporationDetails = null; |
|
| 187 | for ($i = 0; $i < $retries; $i++) { |
|
| 188 | $corporationDetails = corpDetails($corpID); |
|
| 189 | if (!is_null($corporationDetails)) { |
|
| 190 | break; |
|
| 191 | } |
|
| 192 | } |
|
| 193 | if (!$corporationDetails || isset($corporationDetails['error'])) { |
|
| 194 | $this->logger->addInfo('AuthCheck: corpDetails lookup failed.'); |
|
| 195 | $msg = isset($corporationDetails['error']) ? $corporationDetails['error'] : 'corpDetails lookup failed'; |
|
| 196 | throw new Exception($msg); |
|
| 197 | } |
|
| 198 | $this->corpCache[$corpID] = $corporationDetails; |
|
| 199 | return $corporationDetails; |
|
| 200 | } |
|
| 201 | ||
| 202 | private function isMemberInValidCorp($member) |
|
| 203 | { |
|