Completed
Pull Request — master (#21)
by
unknown
02:08
created

PseudoRandomBytesGenerator   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 20
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A generate() 0 4 1
1
<?php
2
3
namespace Knp\Rad\User\Password\Generator;
4
5
use Knp\Rad\User\Password\Generator;
6
7
class PseudoRandomBytesGenerator implements Generator
8
{
9
    /**
10
     * @var int
11
     */
12
    private $length;
13
14
    /**
15
     * @param int $length
16
     */
17
    public function __construct($length)
18
    {
19
        $this->length = $length;
20
    }
21
22
    public function generate()
23
    {
24
        return openssl_random_pseudo_bytes($this->length);
25
    }
26
}
27