Failed Conditions
Push — master ( a3629e...b4f6c5 )
by Florent
08:47
created

ClientOwnerChangedEvent::createFromJson()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.9332
c 0
b 0
f 0
cc 2
nc 2
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * The MIT License (MIT)
7
 *
8
 * Copyright (c) 2014-2018 Spomky-Labs
9
 *
10
 * This software may be modified and distributed under the terms
11
 * of the MIT license.  See the LICENSE file for details.
12
 */
13
14
namespace OAuth2Framework\Component\Core\Client\Event;
15
16
use OAuth2Framework\Component\Core\Client\ClientId;
17
use OAuth2Framework\Component\Core\Event\Event;
18
use OAuth2Framework\Component\Core\Id\Id;
19
use OAuth2Framework\Component\Core\UserAccount\UserAccountId;
20
21
class ClientOwnerChangedEvent extends Event
22
{
23
    private $clientId;
24
    private $newOwnerId;
25
26
    public function __construct(ClientId $clientId, UserAccountId $newOwnerId)
27
    {
28
        $this->clientId = $clientId;
29
        $this->newOwnerId = $newOwnerId;
30
    }
31
32
    public static function getSchema(): string
33
    {
34
        return 'https://oauth2-framework.spomky-labs.com/schemas/events/client/owner-changed/1.0/schema';
35
    }
36
37
    public function getDomainId(): Id
38
    {
39
        return $this->getClientId();
40
    }
41
42
    public function getClientId(): ClientId
43
    {
44
        return $this->clientId;
45
    }
46
47
    public function getNewOwnerId(): UserAccountId
48
    {
49
        return $this->newOwnerId;
50
    }
51
52
    public function getPayload()
53
    {
54
        return [
55
            'new_owner_id' => $this->newOwnerId->getValue(),
56
        ];
57
    }
58
}
59