LastResortGenerator   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
eloc 4
dl 0
loc 15
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 2
A generateForProperty() 0 3 1
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