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.

ApproveControlFactory   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A create() 0 8 2
1
<?php
2
declare(strict_types=1);
3
4
namespace Lookyman\NetteOAuth2Server\UI;
5
6
use League\OAuth2\Server\AuthorizationServer;
7
use League\OAuth2\Server\RequestTypes\AuthorizationRequest;
8
use Nette\Http\Session;
9
use Psr\Log\LoggerAwareInterface;
10
use Psr\Log\LoggerAwareTrait;
11
12
class ApproveControlFactory implements IApproveControlFactory, LoggerAwareInterface
13
{
14
	use LoggerAwareTrait;
15
16
	/**
17
	 * @var AuthorizationServer
18
	 */
19
	private $authorizationServer;
20
21
	/**
22
	 * @var Session
23
	 */
24
	private $session;
25
26
	/**
27
	 * @param AuthorizationServer $authorizationServer
28
	 * @param Session $session
29
	 */
30
	public function __construct(AuthorizationServer $authorizationServer, Session $session)
31
	{
32
		$this->authorizationServer = $authorizationServer;
33
		$this->session = $session;
34
	}
35
36
	/**
37
	 * @param AuthorizationRequest $authorizationRequest
38
	 * @return ApproveControl
39
	 */
40
	public function create(AuthorizationRequest $authorizationRequest): ApproveControl
41
	{
42
		$control = new ApproveControl($this->authorizationServer, $this->session, $authorizationRequest);
43
		if ($this->logger) {
44
			$control->setLogger($this->logger);
45
		}
46
		return $control;
47
	}
48
}
49