AuthorWasDeleted::getId()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 0
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Domain\Author\Events;
6
7
use App\Domain\Common\ValueObject\AggregateRootId;
8
use Prooph\EventSourcing\AggregateChanged;
0 ignored issues
show
Bug introduced by
The type Prooph\EventSourcing\AggregateChanged 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...
9
10
final class AuthorWasDeleted extends AggregateChanged
11
{
12
    /**
13
     * @var AggregateRootId
14
     */
15
    private $id;
16
17
    public static function createWithData(AggregateRootId $id): self
18
    {
19
        /** @var self $event */
20
        $event = self::occur($id->toString(), []);
21
22
        $event->id = $id;
23
24
        return $event;
25
    }
26
27
    public function getId(): AggregateRootId
28
    {
29
        if (null === $this->id) {
30
            $this->id = AggregateRootId::fromString($this->aggregateId());
31
        }
32
33
        return $this->id;
34
    }
35
}
36