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.

RedirectConfig::getApproveDestination()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
c 0
b 0
f 0
rs 9.4285
cc 2
eloc 4
nc 2
nop 0
1
<?php
2
declare(strict_types=1);
3
4
namespace Lookyman\NetteOAuth2Server;
5
6
use Nette\InvalidStateException;
7
8
class RedirectConfig
9
{
10
	/**
11
	 * @var array
12
	 */
13
	private $approveDestination;
14
15
	/**
16
	 * @var array
17
	 */
18
	private $loginDestination;
19
20
	/**
21
	 * @param string|array|null $approveDestination
22
	 * @param string|array|null $loginDestination
23
	 */
24
	public function __construct($approveDestination, $loginDestination)
25
	{
26
		$this->approveDestination = (array) $approveDestination;
27
		$this->loginDestination = (array) $loginDestination;
28
	}
29
30
	/**
31
	 * @return array
32
	 * @throws InvalidStateException
33
	 */
34
	public function getApproveDestination(): array
35
	{
36
		if (empty($this->approveDestination)) {
37
			throw new InvalidStateException('Approve destination not set');
38
		}
39
		return $this->approveDestination;
40
	}
41
42
	/**
43
	 * @return array
44
	 * @throws InvalidStateException
45
	 */
46
	public function getLoginDestination(): array
47
	{
48
		if (empty($this->loginDestination)) {
49
			throw new InvalidStateException('Login destination not set');
50
		}
51
		return $this->loginDestination;
52
	}
53
}
54