Company::company()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace DummyGenerator\Core;
6
7
use DummyGenerator\Definitions\Extension\Awareness\GeneratorAwareExtensionInterface;
8
use DummyGenerator\Definitions\Extension\Awareness\GeneratorAwareExtensionTrait;
9
use DummyGenerator\Definitions\Extension\Awareness\RandomizerAwareExtensionInterface;
10
use DummyGenerator\Definitions\Extension\Awareness\RandomizerAwareExtensionTrait;
11
use DummyGenerator\Definitions\Extension\CompanyExtensionInterface;
12
13
class Company implements CompanyExtensionInterface, GeneratorAwareExtensionInterface, RandomizerAwareExtensionInterface
14
{
15
    use GeneratorAwareExtensionTrait;
16
    use RandomizerAwareExtensionTrait;
17
18
    /** @var string[]  */
19
    protected array $formats = [
20
        '{{lastName}} {{companySuffix}}',
21
    ];
22
23
    /** @var string[]  */
24
    protected array $companySuffix = ['Ltd'];
25
26
    /** @var string[]  */
27
    protected array $jobTitleFormat = [
28
        '{{word}}',
29
    ];
30
31 1
    public function company(): string
32
    {
33 1
        $format = $this->randomizer->randomElement($this->formats);
34
35 1
        return $this->generator->parse($format);
36
    }
37
38 2
    public function companySuffix(): string
39
    {
40 2
        return $this->randomizer->randomElement($this->companySuffix);
41
    }
42
43 1
    public function jobTitle(): string
44
    {
45 1
        $format = $this->randomizer->randomElement($this->jobTitleFormat);
46
47 1
        return $this->generator->parse($format);
48
    }
49
}
50