#276: если система скинов недоступна, то генерируем ответ самостоятельно

This commit is contained in:
ErickSkrauch
2016-12-23 01:50:34 +03:00
parent c029db82a1
commit 3bde676217
2 changed files with 30 additions and 8 deletions

View File

@@ -8,21 +8,26 @@ class Api {
const BASE_DOMAIN = 'http://skinsystem.ely.by';
public function textures($username) : array {
/**
* @param string $username
* @throws \GuzzleHttp\Exception\GuzzleException
*
* @return array
*/
public function textures(string $username): array {
$response = $this->getClient()->get($this->getBuildUrl('/textures/' . $username));
$textures = json_decode($response->getBody(), true);
return $textures;
return json_decode($response->getBody(), true);
}
protected function getBuildUrl(string $url) : string {
protected function getBuildUrl(string $url): string {
return self::BASE_DOMAIN . $url;
}
/**
* @return GuzzleClient
*/
protected function getClient() : GuzzleClient {
protected function getClient(): GuzzleClient {
return Yii::$app->guzzle;
}