RandomIntegerVariable   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
1
<?php
2
/**
3
 * NextFlow (http://github.com/nextflow)
4
 *
5
 * @link http://github.com/nextflow/nextflow-php for the canonical source repository
6
 * @copyright Copyright (c) 2014-2016 NextFlow (http://github.com/nextflow)
7
 * @license https://raw.github.com/nextflow/nextflow-php/master/LICENSE MIT
8
 */
9
10
namespace NextFlow\Math\Variable;
11
12
use NextFlow\Php\Variable\IntegerVariable;
13
14
/**
15
 * A variable that holds a random integer variable.
16
 */
17
final class RandomIntegerVariable extends IntegerVariable
18
{
19
    /**
20
     * Initializes a new instance of this class.
21
     *
22
     * @param int $min The minimum value.
23
     * @param int $max The maximum value.
24
     */
25
    public function __construct($min = 0, $max = PHP_INT_MAX)
26
    {
27
        $value = rand($min, $max);
28
29
        parent::__construct($value);
30
    }
31
}
32