Uuid::toString()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace RayRutjes\GetEventStore;
4
5
use Ramsey\Uuid\UuidInterface;
6
7
class Uuid
8
{
9
    /**
10
     * @var UuidInterface
11
     */
12
    private $value;
13
14
    /**
15
     * @param string $value
16
     */
17
    public function __construct(string $value)
18
    {
19
        if (!\Ramsey\Uuid\Uuid::isValid($value)) {
20
            throw new \InvalidArgumentException(sprintf('%s is not a valid Uuid.', $value));
21
        }
22
        $this->value = \Ramsey\Uuid\Uuid::fromString($value);
23
    }
24
25
    /**
26
     * @return string
27
     */
28
    public function toString(): string
29
    {
30
        return $this->value->toString();
31
    }
32
}
33