Passed
Pull Request — master (#11)
by Pol
02:31
created

TestInfo::getRpUri()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Facile\OpenIDClient\ConformanceTest;
6
7
class TestInfo
8
{
9
    public const PROFILE_BASIC_CODE = 'code-basic';
10
    public const PROFILE_IMPLICIT_IDTOKEN = 'id_token-implicit';
11
    public const PROFILE_IMPLICIT_IDTOKEN_TOKEN = 'id_token+token-hybrid';
12
    public const PROFILE_HYBRID_CODE_IDTOKEN = 'code+id_token-hybrid';
13
    public const PROFILE_HYBRID_CODE_IDTOKEN_TOKEN = 'code+id_token+token-hybrid';
14
    public const PROFILE_HYBRID_CODE_TOKEN = 'code+token-hybrid';
15
    public const PROFILE_CONFIGURATION = 'configuration';
16
    public const PROFILE_DYNAMIC = 'dynamic';
17
18
    /** @var string  */
19
    private $profile;
20
    /** @var string */
21
    private $responseType;
22
    /** @var string */
23
    private $rpId;
24
    /** @var string */
25
    private $root;
26
27
    /**
28
     * TestInfo constructor.
29
     * @param string $profile
30
     * @param string $responseType
31
     * @param string $baseRpId
32
     * @param string $root
33
     */
34
    public function __construct(
35
        string $profile,
36
        string $responseType = 'code',
37
        string $baseRpId = 'tmv_php-openid-client',
38
        string $root = 'https://rp.certification.openid.net:8080/'
39
    )
40
    {
41
        $this->profile = $profile;
42
        $this->responseType = $responseType;
43
        $this->rpId = $baseRpId;
44
        $this->root = rtrim($root, '/');
45
    }
46
47
    /**
48
     * @return string
49
     */
50
    public function getProfile(): string
51
    {
52
        return $this->profile;
53
    }
54
55
    /**
56
     * @return string
57
     */
58
    public function getResponseType(): string
59
    {
60
        return $this->responseType;
61
    }
62
63
    public function getRpId(): string
64
    {
65
        return $this->rpId . '.' . \str_replace(' ', '_', $this->getResponseType());
66
    }
67
68
    public function getRoot(): string
69
    {
70
        return $this->root;
71
    }
72
73
    public function getRpUri(): string
74
    {
75
        return $this->getRoot() . '/' . $this->getRpId();
76
    }
77
78
    public function getRpLogsUri(): string
79
    {
80
        return $this->getRoot() . '/log/' . $this->getRpId();
81
    }
82
}
83