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

ClientParametersUpdatedEvent::createFromJson()   A

Complexity

Conditions 1
Paths 1

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 1
nc 1
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\DataBag\DataBag;
18
use OAuth2Framework\Component\Core\Event\Event;
19
use OAuth2Framework\Component\Core\Id\Id;
20
21
class ClientParametersUpdatedEvent extends Event
22
{
23
    private $clientId;
24
25
    private $parameters;
26
27
    protected function __construct(ClientId $clientId, DataBag $parameters)
28
    {
29
        $this->clientId = $clientId;
30
        $this->parameters = $parameters;
31
    }
32
33
    public static function getSchema(): string
34
    {
35
        return 'https://oauth2-framework.spomky-labs.com/schemas/events/client/parameters-updated/1.0/schema';
36
    }
37
38
    public function getClientId(): ClientId
39
    {
40
        return $this->clientId;
41
    }
42
43
    public function getParameters(): DataBag
44
    {
45
        return $this->parameters;
46
    }
47
48
    public function getDomainId(): Id
49
    {
50
        return $this->getClientId();
51
    }
52
53
    public function getPayload()
54
    {
55
        return [
56
            'parameters' => (object) $this->parameters->all(),
57
        ];
58
    }
59
}
60