Failed Conditions
Push — ng ( 977556...d85ce7 )
by Florent
03:52
created

ClientConfigurationRouteRule   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A handle() 0 7 1
getRegistrationClientUri() 0 1 ?
generateRegistrationAccessToken() 0 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\ClientConfigurationEndpoint\Rule;
15
16
use OAuth2Framework\Component\ClientRule\Rule;
17
use OAuth2Framework\Component\Core\Client\ClientId;
18
use OAuth2Framework\Component\Core\DataBag\DataBag;
19
20
abstract class ClientConfigurationRouteRule implements Rule
21
{
22
    /**
23
     * {@inheritdoc}
24
     */
25
    public function handle(ClientId $clientId, DataBag $commandParameters, DataBag $validatedParameters, callable $next): DataBag
26
    {
27
        $validatedParameters = $validatedParameters->with('registration_access_token', $this->generateRegistrationAccessToken());
28
        $validatedParameters = $validatedParameters->with('registration_client_uri', $this->getRegistrationClientUri($clientId));
29
30
        return $next($clientId, $commandParameters, $validatedParameters);
31
    }
32
33
    /**
34
     * @param ClientId $clientId
35
     *
36
     * @return string
37
     */
38
    abstract protected function getRegistrationClientUri(ClientId $clientId): string;
39
40
    /**
41
     * @return string
42
     */
43
    abstract protected function generateRegistrationAccessToken(): string;
44
}
45