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.
Passed
Push — master ( 2d0137...54f172 )
by Yong
12:14 queued 08:03
created

RamRoleArnCredential::getRoleArn()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
namespace AlibabaCloud\Client\Credentials;
4
5
use AlibabaCloud\Client\Filter\CredentialFilter;
6
use AlibabaCloud\Client\Exception\ClientException;
7
8
/**
9
 * Use the AssumeRole of the RAM account to complete  the authentication.
10
 *
11
 * @package   AlibabaCloud\Client\Credentials
12
 */
13
class RamRoleArnCredential implements CredentialsInterface
14
{
15
16
    /**
17
     * @var string
18
     */
19
    private $accessKeyId;
20
21
    /**
22
     * @var string
23
     */
24
    private $accessKeySecret;
25
26
    /**
27
     * @var string
28
     */
29
    private $roleArn;
30
31
    /**
32
     * @var string
33
     */
34
    private $roleSessionName;
35
36
    /**
37
     * @var string
38
     */
39
    private $policy;
40
41
    /**
42
     * Class constructor.
43
     *
44
     * @param string       $accessKeyId
45
     * @param string       $accessKeySecret
46
     * @param string       $roleArn
47
     * @param string       $roleSessionName
48
     * @param string|array $policy
49
     *
50
     * @throws ClientException
51
     */
52 20
    public function __construct($accessKeyId, $accessKeySecret, $roleArn, $roleSessionName, $policy = '')
53
    {
54 20
        CredentialFilter::AccessKey($accessKeyId, $accessKeySecret);
55
56 12
        $this->accessKeyId     = $accessKeyId;
57 12
        $this->accessKeySecret = $accessKeySecret;
58 12
        $this->roleArn         = $roleArn;
59 12
        $this->roleSessionName = $roleSessionName;
60 12
        $this->policy          = $policy;
0 ignored issues
show
Documentation Bug introduced by
It seems like $policy can also be of type array. However, the property $policy is declared as type string. Maybe add an additional type check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

    public function __construct($id)
    {
        $this->id = $id;
    }

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
61 12
    }
62
63
    /**
64
     * @return string
65
     */
66 9
    public function getAccessKeyId()
67
    {
68 9
        return $this->accessKeyId;
69
    }
70
71
    /**
72
     * @return string
73
     */
74 9
    public function getAccessKeySecret()
75
    {
76 9
        return $this->accessKeySecret;
77
    }
78
79
    /**
80
     * @return string
81
     */
82 10
    public function getRoleArn()
83
    {
84 10
        return $this->roleArn;
85
    }
86
87
    /**
88
     * @return string
89
     */
90 10
    public function getRoleSessionName()
91
    {
92 10
        return $this->roleSessionName;
93
    }
94
95
    /**
96
     * @return string
97
     */
98 8
    public function getPolicy()
99
    {
100 8
        return $this->policy;
101
    }
102
103
    /**
104
     * @return string
105
     */
106 11
    public function __toString()
107
    {
108 11
        return "$this->accessKeyId#$this->accessKeySecret#$this->roleArn#$this->roleSessionName";
109
    }
110
}
111