Uuid   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 26
rs 10

2 Methods

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