WithFaker::faker()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 0
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
4
namespace SmartWeb\ModuleTesting\Util;
5
6
use Faker\Factory;
7
use Faker\Generator;
8
9
10
/**
11
 * Trait WithFaker
12
 *
13
 * @package SmartWeb\ModuleTesting\Util
14
 */
15
trait WithFaker
16
{
17
    
18
    /**
19
     * @var Generator
20
     */
21
    protected static $faker;
22
    
23
    /**
24
     * @return Generator
25
     */
26
    protected function faker()
27
    {
28
        return static::$faker = (isset(static::$faker))
29
            ? static::$faker
30
            : Factory::create();
31
    }
32
}
33