GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

YandexWebmasterOAuth::saveAccessToken()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace app\backend\clients;
4
5
use app\backend\models\ApiService;
6
use Yii;
7
use yii\authclient\OAuthToken;
8
9
class YandexWebmasterOAuth extends \yii\authclient\clients\YandexOAuth
10
{
11
12
    public $hostId;
13
14
    public function init()
15
    {
16
        parent::init();
17
        $this->apiBaseUrl = "https://webmaster.yandex.ru/api/v2/hosts/{$this->hostId}";
18
    }
19
20
    /**
21
     * Saves token in DB.
22
     * @param OAuthToken $token
23
     * @return ApiService|null|\yii\db\ActiveQuery|\yii\db\ActiveRecord|static
0 ignored issues
show
Documentation introduced by
Consider making the return type a bit more specific; maybe use null|\yii\db\ActiveQuery|\yii\db\ActiveRecord.

This check looks for the generic type array as a return type and suggests a more specific type. This type is inferred from the actual code.

Loading history...
24
     */
25
    protected function saveAccessToken(OAuthToken $token)
26
    {
27
        return ApiService::saveToken($this->id, $token);
28
    }
29
30
    /**
31
     * Restores access token.
32
     * @return OAuthToken auth token.
33
     */
34
    protected function restoreAccessToken()
35
    {
36
        $token = ApiService::getToken($this->id);
37
        if (is_object($token)) {
38
            /* @var $token OAuthToken */
39
            if ($token->getIsExpired()) {
40
                $token = $this->refreshAccessToken($token);
41
            }
42
        }
43
        return $token;
44
    }
45
}
46