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.

AccessTokenEntity   A
last analyzed

Complexity

Total Complexity 18

Size/Duplication

Total Lines 168
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 3

Importance

Changes 0
Metric Value
wmc 18
lcom 2
cbo 3
dl 0
loc 168
rs 10
c 0
b 0
f 0

15 Methods

Rating   Name   Duplication   Size   Complexity  
A getId() 0 4 1
A __construct() 0 4 1
A __clone() 0 4 1
A isRevoked() 0 4 1
A setRevoked() 0 4 1
A getClient() 0 4 1
A getExpiryDateTime() 0 4 1
A getUserIdentifier() 0 4 1
A getScopes() 0 4 1
A getIdentifier() 0 4 1
A setIdentifier() 0 4 1
A setExpiryDateTime() 0 4 1
A setUserIdentifier() 0 4 1
A setClient() 0 6 2
A addScope() 0 6 3
1
<?php
2
declare(strict_types=1);
3
4
namespace Lookyman\NetteOAuth2Server\Storage\Doctrine\AccessToken;
5
6
use Doctrine\Common\Collections\ArrayCollection;
7
use Doctrine\Common\Collections\Collection;
8
use Doctrine\ORM\Mapping as ORM;
9
use League\OAuth2\Server\Entities\AccessTokenEntityInterface;
10
use League\OAuth2\Server\Entities\ClientEntityInterface;
11
use League\OAuth2\Server\Entities\ScopeEntityInterface;
12
use League\OAuth2\Server\Entities\Traits\AccessTokenTrait;
13
use Lookyman\NetteOAuth2Server\Storage\Doctrine\Client\ClientEntity;
14
use Lookyman\NetteOAuth2Server\Storage\Doctrine\Scope\ScopeEntity;
15
16
/**
17
 * @ORM\Entity()
18
 * @ORM\Table(name="access_token")
19
 */
20
class AccessTokenEntity implements AccessTokenEntityInterface
21
{
22
	use AccessTokenTrait;
23
24
	/**
25
	 * @ORM\Id()
26
	 * @ORM\GeneratedValue()
27
	 * @ORM\Column(type="integer")
28
	 * @var int
29
	 */
30
	private $id;
31
32
	/**
33
	 * @ORM\Column(type="boolean")
34
	 * @var bool
35
	 */
36
	private $revoked = false;
37
38
	/**
39
	 * @ORM\ManyToOne(targetEntity="Lookyman\NetteOAuth2Server\Storage\Doctrine\Client\ClientEntity", cascade={"persist"})
40
	 * @ORM\JoinColumn(nullable=false)
41
	 * @var ClientEntity
42
	 */
43
	private $client;
44
45
	/**
46
	 * @ORM\Column(type="datetimetz")
47
	 * @var \DateTime
48
	 */
49
	private $expiryDateTime;
50
51
	/**
52
	 * @ORM\Column(type="text", nullable=true)
53
	 * @var string
54
	 */
55
	private $userIdentifier;
56
57
	/**
58
	 * @ORM\ManyToMany(targetEntity="Lookyman\NetteOAuth2Server\Storage\Doctrine\Scope\ScopeEntity")
59
	 * @ORM\JoinTable(name="access_token_scope")
60
	 * @var Collection of ScopeEntity
61
	 */
62
	private $scopes;
63
64
	/**
65
	 * @ORM\Column(type="string", length=80, unique=true)
66
	 * @var string
67
	 */
68
	private $identifier;
69
70
	public function __construct()
71
	{
72
		$this->scopes = new ArrayCollection();
73
	}
74
75
	/**
76
	 * @return int|null
77
	 */
78
	public function getId()
79
	{
80
		return $this->id;
81
	}
82
83
	public function __clone()
84
	{
85
		$this->id = null;
86
	}
87
88
	/**
89
	 * @return bool
90
	 */
91
	public function isRevoked(): bool
92
	{
93
		return $this->revoked;
94
	}
95
96
	/**
97
	 * @param bool $revoked
98
	 */
99
	public function setRevoked(bool $revoked)
100
	{
101
		$this->revoked = $revoked;
102
	}
103
104
	/**
105
	 * @return ClientEntityInterface
106
	 */
107
	public function getClient()
108
	{
109
		return $this->client;
110
	}
111
112
	/**
113
	 * @return \DateTime
114
	 */
115
	public function getExpiryDateTime()
116
	{
117
		return $this->expiryDateTime;
118
	}
119
120
	/**
121
	 * @return string
122
	 */
123
	public function getUserIdentifier()
124
	{
125
		return $this->userIdentifier;
126
	}
127
128
	/**
129
	 * @return ScopeEntityInterface[]
130
	 */
131
	public function getScopes()
132
	{
133
		return $this->scopes->toArray();
134
	}
135
136
	/**
137
	 * @return string
138
	 */
139
	public function getIdentifier()
140
	{
141
		return $this->identifier;
142
	}
143
144
	/**
145
	 * @param string $identifier
146
	 */
147
	public function setIdentifier($identifier)
148
	{
149
		$this->identifier = $identifier;
150
	}
151
152
	/**
153
	 * @param \DateTime $dateTime
154
	 */
155
	public function setExpiryDateTime(\DateTime $dateTime)
156
	{
157
		$this->expiryDateTime = $dateTime;
158
	}
159
160
	/**
161
	 * @param string $identifier
162
	 */
163
	public function setUserIdentifier($identifier)
164
	{
165
		$this->userIdentifier = $identifier;
166
	}
167
168
	/**
169
	 * @param ClientEntityInterface $client
170
	 */
171
	public function setClient(ClientEntityInterface $client)
172
	{
173
		if ($client instanceof ClientEntity) {
174
			$this->client = $client;
175
		}
176
	}
177
178
	/**
179
	 * @param ScopeEntityInterface $scope
180
	 */
181
	public function addScope(ScopeEntityInterface $scope)
182
	{
183
		if ($scope instanceof ScopeEntity && !$this->scopes->contains($scope)) {
184
			$this->scopes->add($scope);
185
		}
186
	}
187
}
188