LocalClient   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 4
Bugs 0 Features 2
Metric Value
wmc 3
c 4
b 0
f 2
lcom 1
cbo 1
dl 0
loc 35
ccs 7
cts 7
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A generateId() 0 4 1
A status() 0 4 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