LastResortGenerator::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 1
nop 1
crap 2
1
<?php
2
3
namespace Er1z\FakeMock\Generator;
4
5
use Er1z\FakeMock\FakeMock;
6
use Er1z\FakeMock\Faker\Registry;
7
use Er1z\FakeMock\Faker\RegistryInterface;
8
use Er1z\FakeMock\Metadata\FieldMetadata;
9
10
class LastResortGenerator implements GeneratorInterface
11
{
12
    /**
13
     * @var Registry
14
     */
15
    private $fakerRegistry;
16
17 82
    public function __construct(?RegistryInterface $fakerRegistry = null)
18
    {
19 82
        $this->fakerRegistry = $fakerRegistry ?: new Registry();
20 82
    }
21
22 23
    public function generateForProperty(FieldMetadata $field, FakeMock $fakemock, ?string $group = null)
23
    {
24 23
        return $this->fakerRegistry->getGeneratorForField($field)->name();
25
    }
26
}
27