AuthenticationRequest::getAccessToken()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 3
rs 10
ccs 2
cts 2
cp 1
crap 1
1
<?php
2
3
namespace Jalle19\StatusManager\Message\Request;
4
5
use Jalle19\StatusManager\Exception\MalformedRequestException;
6
use Jalle19\StatusManager\Message\AbstractMessage;
7
8
/**
9
 * Class AuthenticationRequest
10
 * @package   Jalle19\StatusManager\Message\Request
11
 * @copyright Copyright &copy; Sam Stenvall 2016-
12
 * @license   https://www.gnu.org/licenses/gpl.html The GNU General Public License v2.0
13
 */
14
class AuthenticationRequest extends AbstractMessage
15
{
16
17
	/**
18
	 * AuthenticationRequest constructor.
19
	 *
20
	 * @param string $accessToken
21
	 */
22 5
	public function __construct($accessToken)
23
	{
24 5
		if (!is_string($accessToken))
0 ignored issues
show
introduced by
The condition is_string($accessToken) is always true.
Loading history...
25 5
			throw new MalformedRequestException('Malformed access token');
26
27 4
		parent::__construct(self::TYPE_AUTHENTICATION_REQUEST, $accessToken);
28 4
	}
29
30
31
	/**
32
	 * @return string
33
	 */
34 4
	public function getAccessToken()
35
	{
36 4
		return $this->getPayload();
37
	}
38
39
}
40