Failed Conditions
Push — master ( 104856...f1eb38 )
by Florent
02:37
created

PublicKeyCredentialParameters   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 48
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A jsonSerialize() 0 5 1
A getType() 0 3 1
A getAlg() 0 3 1
A __construct() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * The MIT License (MIT)
7
 *
8
 * Copyright (c) 2018 Spomky-Labs
9
 *
10
 * This software may be modified and distributed under the terms
11
 * of the MIT license.  See the LICENSE file for details.
12
 */
13
14
namespace U2FAuthentication\Fido2;
15
16
class PublicKeyCredentialParameters implements \JsonSerializable
17
{
18
    /**
19
     * @var string
20
     */
21
    private $type;
22
23
    /**
24
     * @var int
25
     */
26
    private $alg;
27
28
    /**
29
     * PublicKeyCredentialParameters constructor.
30
     *
31
     * @param string $type
32
     * @param int    $alg
33
     */
34
    public function __construct(string $type, int $alg)
35
    {
36
        $this->type = $type;
37
        $this->alg = $alg;
38
    }
39
40
    /**
41
     * @return string
42
     */
43
    public function getType(): string
44
    {
45
        return $this->type;
46
    }
47
48
    /**
49
     * @return int
50
     */
51
    public function getAlg(): int
52
    {
53
        return $this->alg;
54
    }
55
56
    /**
57
     * {@inheritdoc}
58
     */
59
    public function jsonSerialize(): array
60
    {
61
        return [
62
            'type' => $this->type,
63
            'alg'  => $this->alg,
64
        ];
65
    }
66
}
67