Completed
Pull Request — master (#19)
by Pierre
01:41
created

RandomBytesGenerator::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 4
rs 10
c 1
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace Knp\Rad\User\Salt\Generator;
4
5
use Knp\Rad\User\Salt\Generator;
6
7
class RandomBytesGenerator 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
    /**
23
     * {@inheritdoc}
24
     */
25
    public function generate()
26
    {
27
        return openssl_random_pseudo_bytes($this->length);
28
    }
29
}
30