AttestationStatement   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 32
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getFmt() 0 3 1
A has() 0 3 1
A get() 0 5 1
A getAttStmt() 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) 2014-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\AttestationStatement;
15
16
use Assert\Assertion;
17
18
class AttestationStatement
19
{
20
    private $fmt;
21
22
    private $attStmt;
23
24
    public function __construct(string $fmt, array $attStmt)
25
    {
26
        $this->fmt = $fmt;
27
        $this->attStmt = $attStmt;
28
    }
29
30
    public function getFmt(): string
31
    {
32
        return $this->fmt;
33
    }
34
35
    public function getAttStmt(): array
36
    {
37
        return $this->attStmt;
38
    }
39
40
    public function has(string $key): bool
41
    {
42
        return array_key_exists($key, $this->attStmt);
43
    }
44
45
    public function get(string $key)
46
    {
47
        Assertion::true($this->has($key), \Safe\sprintf('The attestation statement has no key "%s".', $key));
48
49
        return $this->attStmt[$key];
50
    }
51
}
52