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.
Completed
Pull Request — master (#9)
by Lukáš
05:10
created

RedirectConfig::setApproveDestination()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
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->setApproveDestination($approveDestination);
27
		$this->setLoginDestination($loginDestination);
28
	}
29
30
	/**
31
	 * @param string|array|null $approveDestination
32
	 */
33
	public function setApproveDestination($approveDestination)
34
	{
35
		$this->approveDestination = (array) $approveDestination;
36
	}
37
38
	/**
39
	 * @return array
40
	 * @throws InvalidStateException
41
	 */
42
	public function getApproveDestination(): array
43
	{
44
		if (empty($this->approveDestination)) {
45
			throw new InvalidStateException('Approve destination not set');
46
		}
47
		return $this->approveDestination;
48
	}
49
50
	/**
51
	 * @param string|array|null $loginDestination
52
	 */
53
	public function setLoginDestination($loginDestination)
54
	{
55
		$this->loginDestination = (array) $loginDestination;
56
	}
57
58
	/**
59
	 * @return array
60
	 * @throws InvalidStateException
61
	 */
62
	public function getLoginDestination(): array
63
	{
64
		if (empty($this->loginDestination)) {
65
			throw new InvalidStateException('Login destination not set');
66
		}
67
		return $this->loginDestination;
68
	}
69
}
70