Passed
Push — main ( ed1bb6...4383ba )
by Slawomir
04:39
created

UserRenamedPostsIEvent::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 5
ccs 4
cts 4
cp 1
crap 1
rs 10
1
<?php
2
3
namespace App\Modules\Posts\Api\Event\Inbound;
4
5
use App\Infrastructure\Events\ApplicationInboundEvent;
6
7
class UserRenamedPostsIEvent extends ApplicationInboundEvent
8
{
9
    const EVENT_NAME = "USER_RENAMED";
10
11
    private string $oldLogin;
12
13
    private string $newLogin;
14
15
    /**
16
     * @param array $data
17
     */
18 3
    public function __construct(array $data)
19
    {
20 3
        parent::__construct( $data);
21 3
        $this->oldLogin = $this->string('oldLogin');
22 3
        $this->newLogin = $this->string('newLogin');
23 3
    }
24
25
    /**
26
     * @return string
27
     */
28 2
    public function getOldLogin(): string
29
    {
30 2
        return $this->oldLogin;
31
    }
32
33
    /**
34
     * @return string
35
     */
36 2
    public function getNewLogin(): string
37
    {
38 2
        return $this->newLogin;
39
    }
40
41
    /**
42 1
     * @return string
43
     */
44
    public static function getName(): string
45
    {
46
        return self::EVENT_NAME;
47
    }
48
}