Passed
Push — master ( 73f61b...6db8b4 )
by David
51s
created

Api::setApi()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
namespace FlexyProject\GitHub\Receiver;
3
4
use FlexyProject\GitHub\AbstractApi;
5
use FlexyProject\GitHub\Receiver\{
6
    Activity\AbstractActivity, Enterprise\AbstractEnterprise, Gists\AbstractGists, GitData\AbstractGitData,
7
    Issues\AbstractIssues, Miscellaneous\AbstractMiscellaneous, Organizations\AbstractOrganizations,
8
    PullRequests\AbstractPullRequests, Repositories\AbstractRepositories
9
};
10
11
/**
12
 * Class Api
13
 *
14
 * @package FlexyProject\GitHub\Receiver
15
 */
16
trait Api
17
{
18
    /** @var  mixed */
19
    protected $api;
20
21
    /**
22
     * Get api
23
     *
24
     * @return AbstractApi|AbstractActivity|AbstractEnterprise|AbstractGists|AbstractGitData|AbstractIssues|AbstractMiscellaneous|AbstractOrganizations|AbstractPullRequests|AbstractRepositories
25
     */
26
    public function getApi()
27
    {
28
        return $this->api;
29
    }
30
31
    /**
32
     * Set api
33
     *
34
     * @param AbstractApi|AbstractActivity|AbstractEnterprise|AbstractGists|AbstractGitData|AbstractIssues|AbstractMiscellaneous|AbstractOrganizations|AbstractPullRequests|AbstractRepositories $api
35
     *
36
     * @return Api
0 ignored issues
show
Comprehensibility Bug introduced by
The return type Api is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
37
     */
38
    public function setApi($api): self
39
    {
40
        $this->api = $api;
41
42
        return $this;
43
    }
44
}