AggregateUuid   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 31
rs 10
c 0
b 0
f 0
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 2
A __toString() 0 3 1
A id() 0 3 1
1
<?php
2
/**
3
 * This file is part of the EventStoreManager package.
4
 *
5
 * (c) Mauro Cassani<https://github.com/mauretto78>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace SimpleEventStoreManager\Domain\Model;
12
13
use Ramsey\Uuid\Uuid;
14
15
class AggregateUuid
16
{
17
    /**
18
     * @var string
19
     */
20
    private $id;
21
22
    /**
23
     * AggregateUuid constructor.
24
     *
25
     * @param null $id
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $id is correct as it would always require null to be passed?
Loading history...
26
     */
27
    public function __construct($id = null)
28
    {
29
        $this->id = ($id) ?: Uuid::uuid4()->toString();
30
    }
31
32
    /**
33
     * @return mixed
34
     */
35
    public function id()
36
    {
37
        return $this->id;
38
    }
39
40
    /**
41
     * @return string
42
     */
43
    public function __toString()
44
    {
45
        return $this->id();
46
    }
47
}
48