Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
75.61% |
31 / 41 |
|
44.44% |
8 / 18 |
CRAP | |
0.00% |
0 / 1 |
LtiProvider | |
75.61% |
31 / 41 |
|
44.44% |
8 / 18 |
22.70 | |
0.00% |
0 / 1 |
__construct | |
100.00% |
16 / 16 |
|
100.00% |
1 / 1 |
1 | |||
getId | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getLabel | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getKey | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getSecret | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getCallbackUrl | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getLtiVersion | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getToolIdentifier | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getToolName | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getToolJwksUrl | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getToolClientId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getToolDeploymentIds | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getToolAudience | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getToolOidcLoginInitiationUrl | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getToolLaunchUrl | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getToolPublicKey | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
jsonSerialize | |
100.00% |
9 / 9 |
|
100.00% |
1 / 1 |
1 | |||
getRoles | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | /** |
4 | * This program is free software; you can redistribute it and/or |
5 | * modify it under the terms of the GNU General Public License |
6 | * as published by the Free Software Foundation; under version 2 |
7 | * of the License (non-upgradable). |
8 | * |
9 | * This program is distributed in the hope that it will be useful, |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | * GNU General Public License for more details. |
13 | * |
14 | * You should have received a copy of the GNU General Public License |
15 | * along with this program; if not, write to the Free Software |
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
17 | * |
18 | * Copyright (c) 2019-2020 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT); |
19 | */ |
20 | |
21 | declare(strict_types=1); |
22 | |
23 | namespace oat\taoLti\models\classes\LtiProvider; |
24 | |
25 | use JsonSerializable; |
26 | |
27 | /** |
28 | * LTI provider business object. |
29 | */ |
30 | class LtiProvider implements JsonSerializable |
31 | { |
32 | /** @var string */ |
33 | private $id; |
34 | |
35 | /** @var string */ |
36 | private $label; |
37 | |
38 | /** @var string */ |
39 | private $key; |
40 | |
41 | /** @var string */ |
42 | private $secret; |
43 | |
44 | /** @var string */ |
45 | private $callbackUrl; |
46 | |
47 | /** @var array */ |
48 | private $roles; |
49 | |
50 | /** @var string */ |
51 | private $ltiVersion; |
52 | |
53 | /** @var string */ |
54 | private $toolClientId; |
55 | |
56 | /** @var string */ |
57 | private $toolAudience; |
58 | |
59 | /** @var string[] */ |
60 | private $toolDeploymentIds = []; |
61 | |
62 | /** @var string */ |
63 | private $toolOidcLoginInitiationUrl; |
64 | |
65 | /** @var string */ |
66 | private $toolLaunchUrl; |
67 | |
68 | /** @var string */ |
69 | private $toolPublicKey; |
70 | |
71 | /** @var string */ |
72 | private $toolIdentifier; |
73 | |
74 | /** @var string */ |
75 | private $toolName; |
76 | |
77 | /** @var string */ |
78 | private $toolJwksUrl; |
79 | |
80 | public function __construct( |
81 | string $id, |
82 | string $label, |
83 | string $key = null, |
84 | string $secret = null, |
85 | string $callbackUrl = null, |
86 | array $roles = [], |
87 | string $ltiVersion = null, |
88 | string $toolIdentifier = null, |
89 | string $toolName = null, |
90 | string $toolClientId = null, |
91 | array $toolDeploymentIds = [], |
92 | string $toolAudience = null, |
93 | string $toolOidcLoginInitiationUrl = null, |
94 | string $toolLaunchUrl = null, |
95 | string $toolPublicKey = null, |
96 | string $toolJwksUrl = null |
97 | ) { |
98 | $this->id = $id; |
99 | $this->label = $label; |
100 | $this->key = $key; |
101 | $this->secret = $secret; |
102 | $this->callbackUrl = $callbackUrl; |
103 | $this->roles = $roles; |
104 | $this->ltiVersion = $ltiVersion; |
105 | $this->toolClientId = $toolClientId; |
106 | $this->toolDeploymentIds = $toolDeploymentIds; |
107 | $this->toolAudience = $toolAudience; |
108 | $this->toolOidcLoginInitiationUrl = $toolOidcLoginInitiationUrl; |
109 | $this->toolLaunchUrl = $toolLaunchUrl; |
110 | $this->toolPublicKey = $toolPublicKey; |
111 | $this->toolIdentifier = $toolIdentifier; |
112 | $this->toolName = $toolName; |
113 | $this->toolJwksUrl = $toolJwksUrl; |
114 | } |
115 | |
116 | public function getId(): string |
117 | { |
118 | return $this->id; |
119 | } |
120 | |
121 | public function getLabel(): string |
122 | { |
123 | return $this->label; |
124 | } |
125 | |
126 | public function getKey(): ?string |
127 | { |
128 | return $this->key; |
129 | } |
130 | |
131 | public function getSecret(): ?string |
132 | { |
133 | return $this->secret; |
134 | } |
135 | |
136 | public function getCallbackUrl(): ?string |
137 | { |
138 | return $this->callbackUrl; |
139 | } |
140 | |
141 | public function getLtiVersion(): string |
142 | { |
143 | return $this->ltiVersion; |
144 | } |
145 | |
146 | public function getToolIdentifier(): string |
147 | { |
148 | return $this->toolIdentifier; |
149 | } |
150 | |
151 | public function getToolName(): string |
152 | { |
153 | return $this->toolName; |
154 | } |
155 | |
156 | public function getToolJwksUrl(): ?string |
157 | { |
158 | return $this->toolJwksUrl; |
159 | } |
160 | |
161 | public function getToolClientId(): string |
162 | { |
163 | return $this->toolClientId; |
164 | } |
165 | |
166 | public function getToolDeploymentIds(): array |
167 | { |
168 | return $this->toolDeploymentIds; |
169 | } |
170 | |
171 | public function getToolAudience(): string |
172 | { |
173 | return $this->toolAudience; |
174 | } |
175 | |
176 | public function getToolOidcLoginInitiationUrl(): string |
177 | { |
178 | return $this->toolOidcLoginInitiationUrl; |
179 | } |
180 | |
181 | public function getToolLaunchUrl(): string |
182 | { |
183 | return $this->toolLaunchUrl; |
184 | } |
185 | |
186 | public function getToolPublicKey(): ?string |
187 | { |
188 | return $this->toolPublicKey; |
189 | } |
190 | |
191 | /** |
192 | * @inheritdoc |
193 | */ |
194 | public function jsonSerialize() |
195 | { |
196 | return [ |
197 | 'id' => $this->getId(), |
198 | 'uri' => $this->getId(), |
199 | 'text' => $this->getLabel(), |
200 | 'key' => $this->getKey(), |
201 | 'secret' => $this->getSecret(), |
202 | 'callback' => $this->getCallbackUrl(), |
203 | 'roles' => $this->getRoles(), |
204 | ]; |
205 | } |
206 | |
207 | public function getRoles(): array |
208 | { |
209 | return $this->roles; |
210 | } |
211 | } |