Passed
Pull Request — master (#84)
by Frank
03:27 queued 01:10
created

DummyAggregateRootId   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Test Coverage

Coverage 81.82%

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 33
ccs 9
cts 11
cp 0.8182
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A toString() 0 3 1
A fromString() 0 3 1
A generate() 0 3 1
A toUuid() 0 3 1
A __construct() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace EventSauce\EventSourcing;
6
7
final class DummyAggregateRootId implements AggregateRootId
8
{
9
    /**
10
     * @var string
11
     */
12
    private $identifier;
13
14 16
    public function __construct(string $identifier)
15
    {
16 16
        $this->identifier = $identifier;
17 16
    }
18
19 7
    public function toString(): string
20
    {
21 7
        return $this->identifier;
22
    }
23
24
    public function toUuid(): UuidInterface
0 ignored issues
show
Bug introduced by
The type EventSauce\EventSourcing\UuidInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
25
    {
26
        return Uuid::fromString($this->identifier);
0 ignored issues
show
Bug introduced by
The type EventSauce\EventSourcing\Uuid was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
27
    }
28
29 13
    public static function generate(): DummyAggregateRootId
30
    {
31 13
        return new DummyAggregateRootId(bin2hex(random_bytes(25)));
32
    }
33
34
    /**
35
     * @return static
36
     */
37 9
    public static function fromString(string $aggregateRootId): AggregateRootId
38
    {
39 9
        return new static($aggregateRootId);
40
    }
41
}
42