AuthenticationResponse::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 3
b 0
f 0
nc 1
nop 4
dl 0
loc 7
rs 9.4285
1
<?php
2
/**
3
 *
4
 * @copyright (c) 2015, Paul Sohier
5
 * @copyright (c) 2014 Yubico AB
6
 * @license BSD-2-Clause
7
 *
8
 *
9
 * Orignal Copyright:
10
 * Copyright (c) 2014 Yubico AB
11
 * All rights reserved.
12
 *
13
 * Redistribution and use in source and binary forms, with or without
14
 * modification, are permitted provided that the following conditions are
15
 * met:
16
 *
17
 *   * Redistributions of source code must retain the above copyright
18
 *     notice, this list of conditions and the following disclaimer.
19
 *
20
 *   * Redistributions in binary form must reproduce the above
21
 *     copyright notice, this list of conditions and the following
22
 *     disclaimer in the documentation and/or other materials provided
23
 *     with the distribution.
24
 *
25
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36
 */
37
38
namespace paul999\u2f;
39
40
/**
41
 * Class for building up an authentication request
42
 *
43
 * @package u2flib_server
44
 */
45
class AuthenticationResponse implements AuthenticationResponseInterface
46
{
47
    /**
48
     * @var string signatureData
49
     */
50
    private $signatureData;
51
52
    /**
53
     * @var string client data
54
     */
55
    private $clientData;
56
57
    /**
58
     * @var string keyHandle
59
     */
60
    private $keyHandle;
61
62
    /**
63
     * @var string errorCode from the browser
64
     */
65
    private $errorCode;
66
67
    /**
68
     * RegisterResponse constructor.
69
     * @param string $signatureData
70
     * @param string $clientData
71
     * @param string $keyHandle
72
     * @param string $errorCode
73
     */
74
    public function __construct($signatureData, $clientData, $keyHandle, $errorCode = null)
75
    {
76
        $this->setSignatureData($signatureData);
77
        $this->setClientData($clientData);
78
        $this->setKeyHandle($keyHandle);
79
        $this->setErrorCode($errorCode);
80
    }
81
82
    /**
83
     * @return string
84
     */
85
    public function getSignatureData()
86
    {
87
        return $this->signatureData;
88
    }
89
90
    /**
91
     * @param string $signatureData
92
     * @return AuthenticationResponseInterface
93
     */
94
    public function setSignatureData($signatureData)
95
    {
96
        $this->signatureData = $signatureData;
97
        return $this;
98
    }
99
100
    /**
101
     * @return string
102
     */
103
    public function getClientData()
104
    {
105
        return $this->clientData;
106
    }
107
108
    /**
109
     * @param string $clientData
110
     * @return AuthenticationResponseInterface
111
     */
112
    public function setClientData($clientData)
113
    {
114
        $this->clientData = $clientData;
115
        return $this;
116
    }
117
118
    /**
119
     * @return string
120
     */
121
    public function getKeyHandle()
122
    {
123
        return $this->keyHandle;
124
    }
125
126
    /**
127
     * @param string $keyHandle
128
     * @return AuthenticationResponseInterface
129
     */
130
    public function setKeyHandle($keyHandle)
131
    {
132
        $this->keyHandle = $keyHandle;
133
        return $this;
134
    }
135
136
    /**
137
     * @return string
138
     */
139
    public function getErrorCode()
140
    {
141
        return $this->errorCode;
142
    }
143
144
    /**
145
     * @param string $errorCode
146
     * @return AuthenticationResponseInterface
147
     */
148
    public function setErrorCode($errorCode)
149
    {
150
        $this->errorCode = $errorCode;
151
        return $this;
152
    }
153
154
}