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

UserRenamedPostsIEvent   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
dl 0
loc 40
ccs 10
cts 10
cp 1
rs 10
c 1
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getOldLogin() 0 3 1
A getNewLogin() 0 3 1
A __construct() 0 5 1
A getName() 0 3 1
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
}