Completed
Push — master ( f5580e...4e6c29 )
by Beñat
01:39
created

Authentication::accessToken()   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 0
1
<?php
2
3
/*
4
 * This file is part of the Stack Exchange Api Client library.
5
 *
6
 * (c) Beñat Espiña <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace BenatEspina\StackExchangeApiClient\Authentication;
15
16
/**
17
 * @author Beñat Espiña <[email protected]>
18
 */
19
final class Authentication
20
{
21
    private $key;
22
    private $accessToken;
23
24
    public function __construct(string $key, string $accessToken)
25
    {
26
        $this->key = $key;
27
        $this->accessToken = $accessToken;
28
    }
29
30
    public function key() : string
31
    {
32
        return $this->key;
33
    }
34
35
    public function accessToken() : string
36
    {
37
        return $this->accessToken;
38
    }
39
40
    public function toArray() : array
41
    {
42
        return ['key' => $this->key, 'access_token' => $this->accessToken];
43
    }
44
45
    public function toUrl() : string
46
    {
47
        return '&access_token=' . $this->accessToken . '&key=' . $this->key;
48
    }
49
}
50