Completed
Push — master ( 2994aa...19d116 )
by Patrick
08:28
created

RandomStringGeneratorTrait   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 0
dl 0
loc 17
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A binToHex() 0 4 1
1
<?php
2
namespace Dropbox\Security;
3
4
trait RandomStringGeneratorTrait
5
{
6
    /**
7
     * Converts binary data to hexadecimal of given length
8
     *
9
     * @param string $binaryData The binary data to convert to hex.
10
     * @param int    $length     The length of the string to return.
11
     *
12
     * @throws \RuntimeException Throws an exception when multibyte support is not enabled
13
     *
14
     * @return string
15
     */
16
    public function binToHex($binaryData, $length)
17
    {
18
        return substr(bin2hex($binaryData), 0, $length);
19
    }
20
}
21