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

ClientParameterChangedEvent   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 1
dl 0
loc 47
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getSchema() 0 4 1
A getClientId() 0 4 1
A getParameter() 0 4 1
A getDomainId() 0 4 1
A getPayload() 0 6 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 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