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

UuidGenerator::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 1
c 1
b 0
f 1
dl 0
loc 3
rs 10
cc 1
nc 1
nop 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