Code Duplication    Length = 28-28 lines in 3 locations

src/Generators/Uuid1Generator.php 1 location

@@ 17-44 (lines=28) @@
14
use Ramsey\Uuid\UuidFactory;
15
use Ramsey\Uuid\UuidFactoryInterface;
16
17
final class Uuid1Generator implements RequestIdGenerator
18
{
19
    private $node;
20
21
    private $clockSeq;
22
23
    private $factory;
24
25
    /**
26
     * @param UuidFactoryInterface $factory
27
     * @param int|string           $node
28
     * @param int                  $clockSeq
29
     */
30
    public function __construct(UuidFactoryInterface $factory = null, $node = null, $clockSeq = null)
31
    {
32
        $this->factory = $factory ?: new UuidFactory();
33
        $this->node = $node;
34
        $this->clockSeq = $clockSeq;
35
    }
36
37
    /**
38
     * @return string
39
     */
40
    public function generate()
41
    {
42
        return $this->factory->uuid1($this->node, $this->clockSeq)->toString();
43
    }
44
}
45

src/Generators/Uuid3Generator.php 1 location

@@ 17-44 (lines=28) @@
14
use Ramsey\Uuid\UuidFactory;
15
use Ramsey\Uuid\UuidFactoryInterface;
16
17
final class Uuid3Generator implements RequestIdGenerator
18
{
19
    private $ns;
20
21
    private $name;
22
23
    private $factory;
24
25
    /**
26
     * @param UuidFactoryInterface $factory
27
     * @param string               $ns
28
     * @param string               $name
29
     */
30
    public function __construct($ns, $name, UuidFactoryInterface $factory = null)
31
    {
32
        $this->factory = $factory ?: new UuidFactory();
33
        $this->ns = $ns;
34
        $this->name = $name;
35
    }
36
37
    /**
38
     * @return string
39
     */
40
    public function generate()
41
    {
42
        return $this->factory->uuid3($this->ns, $this->name)->toString();
43
    }
44
}
45

src/Generators/Uuid5Generator.php 1 location

@@ 17-44 (lines=28) @@
14
use Ramsey\Uuid\UuidFactory;
15
use Ramsey\Uuid\UuidFactoryInterface;
16
17
final class Uuid5Generator implements RequestIdGenerator
18
{
19
    private $ns;
20
21
    private $name;
22
23
    private $factory;
24
25
    /**
26
     * @param UuidFactoryInterface $factory
27
     * @param string               $ns
28
     * @param string               $name
29
     */
30
    public function __construct($ns, $name, UuidFactoryInterface $factory = null)
31
    {
32
        $this->factory = $factory ?: new UuidFactory();
33
        $this->ns = $ns;
34
        $this->name = $name;
35
    }
36
37
    /**
38
     * @return string
39
     */
40
    public function generate()
41
    {
42
        return $this->factory->uuid5($this->ns, $this->name)->toString();
43
    }
44
}
45