Completed
Pull Request — master (#34)
by Adam
02:18
created

Account   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getAccount() 0 3 1
A __construct() 0 3 1
A getDrushAliases() 0 3 1
1
<?php
2
3
namespace AcquiaCloudApi\Endpoints;
4
5
use AcquiaCloudApi\Connector\ClientInterface;
6
use AcquiaCloudApi\Response\AccountResponse;
7
8
/**
9
 * Class Client
10
 * @package AcquiaCloudApi\CloudApi
11
 */
12
class Account implements CloudApi
13
{
14
15
    /**
16
     * Client constructor.
17
     *
18
     * @param ConnectorInterface $connector
0 ignored issues
show
Bug introduced by
The type AcquiaCloudApi\Endpoints\ConnectorInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
19
     */
20
    public function __construct(ClientInterface $client)
21
    {
22
        $this->client = $client;
0 ignored issues
show
Bug Best Practice introduced by
The property client does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
23
    }
24
25
    /**
26
     * Returns details about your account.
27
     *
28
     * @return AccountResponse
29
     */
30
    public function getAccount()
31
    {
32
        return new AccountResponse($this->client->request('get', '/account'));
0 ignored issues
show
Bug introduced by
It seems like $this->client->request('get', '/account') can also be of type array; however, parameter $account of AcquiaCloudApi\Response\...Response::__construct() does only seem to accept object, maybe add an additional type check? ( Ignorable by Annotation )

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

32
        return new AccountResponse(/** @scrutinizer ignore-type */ $this->client->request('get', '/account'));
Loading history...
33
    }
34
35
    /**
36
     * Provides an archived set of files for Acquia Drush aliases.
37
     *
38
     * @return StreamInterface
0 ignored issues
show
Bug introduced by
The type AcquiaCloudApi\Endpoints\StreamInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
39
     */
40
    public function getDrushAliases()
41
    {
42
        return $this->client->request('get', '/account/drush-aliases/download');
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->client->re...rush-aliases/download') also could return the type array which is incompatible with the documented return type AcquiaCloudApi\Endpoints\StreamInterface.
Loading history...
43
    }
44
}
45