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.

CommonInfo   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 16
c 1
b 0
f 0
dl 0
loc 49
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A process() 0 21 2
1
<?php
2
3
namespace Soheilrt\AdobeConnectClient\Client\Commands;
4
5
use Soheilrt\AdobeConnectClient\Client\Abstracts\Command;
6
use Soheilrt\AdobeConnectClient\Client\Converter\Converter;
7
use Soheilrt\AdobeConnectClient\Client\Entities\CommonInfo as CommonInfoEntity;
8
use Soheilrt\AdobeConnectClient\Client\Helpers\SetEntityAttributes as FillObject;
9
use Soheilrt\AdobeConnectClient\Client\Helpers\StatusValidate;
10
use Soheilrt\AdobeConnectClient\Client\Helpers\ValueTransform as VT;
11
12
/**
13
 * Gets the common info.
14
 *
15
 * More info see {@link https://helpx.adobe.com/adobe-connect/webservices/common-info.html#common_info}
16
 */
17
class CommonInfo extends Command
18
{
19
    /**
20
     * @var string
21
     */
22
    protected $domain = '';
23
24
    /**
25
     * CommonInfo class name
26
     *
27
     * @var string
28
     */
29
    protected $className;
30
31
    /**
32
     * @param string $domain
33
     */
34
    public function __construct($domain = '')
35
    {
36
        $this->domain = $domain;
37
        $this->className = $this->getEntity('common-info');
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->getEntity('common-info') can also be of type array. However, the property $className 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...
38
    }
39
40
    /**
41
     * {@inheritdoc}
42
     *
43
     * @return CommonInfoEntity
44
     */
45
    protected function process()
46
    {
47
        $parameters = [
48
            'action' => 'common-info',
49
        ];
50
51
        if (!empty($this->domain)) {
52
            $parameters += [
53
                'domain' => VT::toString($this->domain),
54
            ];
55
        }
56
57
        $response = Converter::convert(
58
            $this->client->doGet($parameters)
0 ignored issues
show
Bug introduced by
The method doGet() does not exist on Soheilrt\AdobeConnectCli...lient\Abstracts\Command. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

58
            $this->client->/** @scrutinizer ignore-call */ 
59
                           doGet($parameters)

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
59
        );
60
        StatusValidate::validate($response['status']);
61
62
        $commonInfo = new $this->className();
63
        FillObject::setAttributes($commonInfo, $response['common']);
64
65
        return $commonInfo;
66
    }
67
}
68