Base::maxDistinct()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 3
c 0
b 0
f 0
nc 2
nop 2
dl 0
loc 7
rs 10
1
<?php
2
3
4
namespace Kaliop\eZLoremIpsumBundle\Faker\Provider;
5
6
use Faker\Generator;
7
use Kaliop\eZLoremIpsumBundle\Faker\MaxDistinctGenerator;
8
9
abstract class Base
10
{
11
    /** @var Generator $generator */
12
    protected $generator;
13
14
    /** @var MaxDistinctGenerator $distinct  */
15
    protected $distinct;
16
17
    public function __construct(Generator $generator)
18
    {
19
        $this->generator = $generator;
20
    }
21
22
    public function maxDistinct($maxElements = 100, $reset = false)
23
    {
24
        if ($reset || !$this->distinct) {
25
            $this->distinct = new MaxDistinctGenerator($this->generator, $maxElements);
26
        }
27
28
        return $this->distinct;
29
    }
30
}
31