QRCode   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 6
Bugs 2 Features 0
Metric Value
wmc 1
eloc 16
c 6
b 2
f 0
dl 0
loc 28
ccs 0
cts 15
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getQRCodeUrl() 0 17 1
1
<?php
2
3
namespace PragmaRX\Google2FA\Support;
4
5
trait QRCode
6
{
7
    /**
8
     * Creates a QR code url.
9
     *
10
     * @param string $company
11
     * @param string $holder
12
     * @param string $secret
13
     *
14
     * @return string
15
     */
16
    public function getQRCodeUrl($company, $holder, $secret)
17
    {
18
        return 'otpauth://totp/' .
19
            rawurlencode($company) .
20
            ':' .
21
            rawurlencode($holder) .
22
            '?secret=' .
23
            $secret .
24
            '&issuer=' .
25
            rawurlencode($company) .
26
            '&algorithm=' .
27
            rawurlencode(strtoupper($this->getAlgorithm())) .
0 ignored issues
show
Bug introduced by
It seems like getAlgorithm() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

27
            rawurlencode(strtoupper($this->/** @scrutinizer ignore-call */ getAlgorithm())) .
Loading history...
28
            '&digits=' .
29
            rawurlencode(strtoupper((string) $this->getOneTimePasswordLength())) .
0 ignored issues
show
Bug introduced by
It seems like getOneTimePasswordLength() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

29
            rawurlencode(strtoupper((string) $this->/** @scrutinizer ignore-call */ getOneTimePasswordLength())) .
Loading history...
30
            '&period=' .
31
            rawurlencode(strtoupper((string) $this->getKeyRegeneration())) .
0 ignored issues
show
Bug introduced by
It seems like getKeyRegeneration() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

31
            rawurlencode(strtoupper((string) $this->/** @scrutinizer ignore-call */ getKeyRegeneration())) .
Loading history...
32
            '';
33
    }
34
}
35