Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
14 / 14
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
Jwk
100.00% covered (success)
100.00%
14 / 14
100.00% covered (success)
100.00%
2 / 2
2
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
1 / 1
1
 jsonSerialize
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
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) 2020 (original work) Open Assessment Technologies SA;
19 */
20
21declare(strict_types=1);
22
23namespace oat\tao\model\security\Business\Domain\Key;
24
25use JsonSerializable;
26
27final class Jwk implements JsonSerializable
28{
29    /** @var string */
30    private $kty;
31
32    /** @var string */
33    private $e;
34
35    /** @var string */
36    private $n;
37
38    /** @var string */
39    private $kid;
40
41    /** @var string */
42    private $alg;
43
44    /** @var string */
45    private $use;
46
47    public function __construct(string $kty, string $e, string $n, string $kid, string $alg, string $use)
48    {
49        $this->kty = $kty;
50        $this->e = $e;
51        $this->n = $n;
52        $this->kid = $kid;
53        $this->alg = $alg;
54        $this->use = $use;
55    }
56
57    public function jsonSerialize(): array
58    {
59        return [
60            'kty' => $this->kty,
61            'e' => $this->e,
62            'n' => $this->n,
63            'kid' => $this->kid,
64            'alg' => $this->alg,
65            'use' => $this->use,
66        ];
67    }
68}