BoardCreatedEvent   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 14
dl 0
loc 20
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A build() 0 16 2
1
<?php
2
/**
3
 *
4
 * This file is part of the Aggrego.
5
 * (c) Tomasz Kunicki <[email protected]>
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
12
declare(strict_types = 1);
13
14
namespace Aggrego\DataDomainBoard\Board\Events;
15
16
use Aggrego\DataDomainBoard\Board\Prototype\Metadata;
17
use Aggrego\Domain\Board\Key;
18
use Aggrego\Domain\Board\Uuid;
19
use Aggrego\Domain\Profile\Profile;
20
use Aggrego\EventConsumer\Event\CreatedAt;
21
use Aggrego\EventConsumer\Event\Domain;
22
use Aggrego\EventConsumer\Event\Name;
23
use Aggrego\EventConsumer\Event\Version;
24
use Aggrego\EventConsumer\Shared\Event;
25
use DateTimeImmutable;
26
27
class BoardCreatedEvent extends Event
28
{
29
    private const DOMAIN_NAME = 'board.data_board';
30
31
    public static function build(Uuid $uuid, Key $key, Profile $profile, Metadata $metadata, ?Uuid $parentUuid): self
32
    {
33
        return new self(
34
            Domain::build(
35
                self::DOMAIN_NAME,
36
                $uuid->getValue()
37
            ),
38
            new Name(self::class),
39
            new CreatedAt(new DateTimeImmutable()),
40
            new Version('1.0.0.0'),
41
            [
42
                'uuid' => $uuid->getValue(),
43
                'key' => $key->getValue(),
44
                'profile' => $profile->__toString(),
45
                'metadata' => $metadata->getData()->getValue(),
46
                'parent_uuid' => $parentUuid ? $parentUuid->getValue() : null,
47
            ]
48
        );
49
    }
50
}
51