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.

Commit::author()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
ccs 0
cts 2
cp 0
cc 1
nc 1
nop 0
crap 2
1
<?php declare(strict_types=1);
2
3
namespace ApiClients\Client\Github\Resource\Git;
4
5
use ApiClients\Client\Github\Resource\TreeInterface;
0 ignored issues
show
Bug introduced by
This use statement conflicts with another class in this namespace, ApiClients\Client\Github...ource\Git\TreeInterface.

Let’s assume that you have a directory layout like this:

.
|-- OtherDir
|   |-- Bar.php
|   `-- Foo.php
`-- SomeDir
    `-- Foo.php

and let’s assume the following content of Bar.php:

// Bar.php
namespace OtherDir;

use SomeDir\Foo; // This now conflicts the class OtherDir\Foo

If both files OtherDir/Foo.php and SomeDir/Foo.php are loaded in the same runtime, you will see a PHP error such as the following:

PHP Fatal error:  Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php

However, as OtherDir/Foo.php does not necessarily have to be loaded and the error is only triggered if it is loaded before OtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias:

// Bar.php
namespace OtherDir;

use SomeDir\Foo as SomeDirFoo; // There is no conflict anymore.
Loading history...
6
use ApiClients\Foundation\Hydrator\Annotation\EmptyResource;
7
use ApiClients\Foundation\Hydrator\Annotation\Nested;
8
use ApiClients\Foundation\Resource\AbstractResource;
9
10
/**
11
 * @Nested(
12
 *     author="User",
13
 *     comitter="User",
14
 *     tree="Tree"
15
 * )
16
 * @EmptyResource("Git\EmptyCommit")
17
 */
18
abstract class Commit extends AbstractResource implements CommitInterface
19
{
20
    /**
21
     * @var string
22
     */
23
    protected $sha;
24
25
    /**
26
     * @var string
27
     */
28
    protected $url;
29
30
    /**
31
     * @var User
32
     */
33
    protected $author;
34
35
    /**
36
     * @var User
37
     */
38
    protected $comitter;
39
40
    /**
41
     * @var string
42
     */
43
    protected $message;
44
45
    /**
46
     * @var Tree
47
     */
48
    protected $tree;
49
50
    /**
51
     * @var int
52
     */
53
    protected $comment_count;
54
55
    /**
56
     * @var string
57
     */
58
    protected $protection_url;
59
60
    /**
61
     * @return string
62
     */
63 4
    public function sha(): string
64
    {
65 4
        return $this->sha;
66
    }
67
68
    /**
69
     * @return string
70
     */
71 4
    public function url(): string
72
    {
73 4
        return $this->url;
74
    }
75
76
    /**
77
     * @return User
78
     */
79
    public function author(): User
80
    {
81
        return $this->author;
82
    }
83
84
    /**
85
     * @return User
86
     */
87
    public function comitter(): User
88
    {
89
        return $this->comitter;
90
    }
91
92
    /**
93
     * @return string
94
     */
95 4
    public function message(): string
96
    {
97 4
        return $this->message;
98
    }
99
100
    /**
101
     * @return TreeInterface
102
     */
103
    public function tree(): TreeInterface
104
    {
105
        return $this->tree;
106
    }
107
108
    /**
109
     * @return int
110
     */
111 4
    public function commentCount(): int
112
    {
113 4
        return $this->comment_count;
114
    }
115
116
    /**
117
     * @return string
118
     */
119 4
    public function protectionUrl(): string
120
    {
121 4
        return $this->protection_url;
122
    }
123
}
124