Passed
Push — master ( dbf047...1b561f )
by Daniel
02:26
created

UuidGenerator   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
eloc 4
c 1
b 0
f 1
dl 0
loc 22
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A generate() 0 3 1
1
<?php
2
3
namespace Jellyfish\UuidRamsey;
4
5
use Jellyfish\Uuid\UuidGeneratorInterface;
6
use Ramsey\Uuid\Uuid;
7
use Ramsey\Uuid\UuidFactoryInterface;
8
9
class UuidGenerator implements UuidGeneratorInterface
10
{
11
    /**
12
     * @var \Ramsey\Uuid\UuidFactoryInterface
13
     */
14
    protected $uuidFactory;
15
16
    /**
17
     * @param \Ramsey\Uuid\UuidFactoryInterface $uuidFactory
18
     */
19
    public function __construct(UuidFactoryInterface $uuidFactory)
20
    {
21
        $this->uuidFactory = $uuidFactory;
22
    }
23
24
25
    /**
26
     * @return string
27
     */
28
    public function generate(): string
29
    {
30
        return $this->uuidFactory->uuid4()->toString();
31
    }
32
}
33