Completed
Branch develop (5d5be1)
by Simon
01:59
created

MockYubiValidate   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
c 0
b 0
f 0
lcom 0
cbo 3
dl 0
loc 25
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A check() 0 16 2
A success() 0 4 1
1
<?php
2
use Yubikey\Response;
3
use Yubikey\ResponseCollection;
4
use Yubikey\Validate;
5
6
7
class MockYubiValidate extends Validate
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
8
{
9
10
    public function check($otp, $multi = false, $fail = false)
11
    {
12
        $nonce = $this->generateNonce();
13
        $result = new Response(array(
14
            'h' => '',
15
            'otp' => 'ccccccfinfgrtjhdeitnirlnggbicvnnthethdljlcvl',
16
            'status' => $fail ? 'BAD_OTP' : 'OK',
17
            'nonce' => $nonce,
18
            'inputNonce' => $nonce,
19
            'inputOtp' => 'ccccccfinfgrtjhdeitnirlnggbicvnnthethdljlcvl',
20
            'host' => 'api.yubico.com',
21
            'sl' => 25,
22
            'timestamp' => time()
23
        ));
24
        return new ResponseCollection(array($result));
25
    }
26
27
    public function success()
28
    {
29
30
    }
31
}