LocalClient::generateId()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Gendoria\CruftFlake\Local;
4
5
use Gendoria\CruftFlake\ClientInterface;
6
use Gendoria\CruftFlake\Generator\Generator;
7
8
/**
9
 * Local CruftFlake client.
10
 * 
11
 * **WARNING** - it should **NOT** be used in production environment,
12
 * unless each instance is guaranteed to receive unique machine ID.
13
 *
14
 * @author Tomasz Struczyński <[email protected]>
15
 */
16
class LocalClient implements ClientInterface
17
{
18
    /**
19
     * Generator instance.
20
     * 
21
     * @var Generator
22
     */
23
    private $generator;
24
25
    /**
26
     * Construct local client class injected with generator instance.
27
     * 
28
     * @param Generator $generator
29
     */
30 2
    public function __construct(Generator $generator)
31
    {
32 2
        $this->generator = $generator;
33 2
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38 2
    public function generateId()
39
    {
40 2
        return $this->generator->generate();
41
    }
42
43
    /**
44
     * {@inheritdoc}
45
     */
46 1
    public function status()
47
    {
48 1
        return $this->generator->status();
49
    }
50
}
51