Failed Conditions
Push — master ( c6baf0...a3629e )
by Florent
16:19
created

ClientParameterChangedEvent::getClientId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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 ClientParameterChangedEvent extends Event
22
{
23
    private $clientId;
24
    private $parameter;
25
26
    public function __construct(ClientId $clientId, DataBag $parameter)
27
    {
28
        $this->clientId = $clientId;
29
        $this->parameter = $parameter;
30
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35
    public static function getSchema(): string
36
    {
37
        return 'https://oauth2-framework.spomky-labs.com/schemas/events/client/parameter-changed/1.0/schema';
38
    }
39
40
    public function getClientId(): ClientId
41
    {
42
        return $this->clientId;
43
    }
44
45
    public function getParameter(): DataBag
46
    {
47
        return $this->parameter;
48
    }
49
50
    /**
51
     * {@inheritdoc}
52
     */
53
    public function getDomainId(): Id
54
    {
55
        return $this->getClientId();
56
    }
57
58
    /**
59
     * {@inheritdoc}
60
     */
61
    public function getPayload()
62
    {
63
        return [
64
            'parameter' => (object) $this->parameter->all(),
65
        ];
66
    }
67
}
68