Failed Conditions
Push — ng ( ede6c5...efffe8 )
by Florent
11:50
created

StateParameterChecker::process()   B

Complexity

Conditions 5
Paths 8

Size

Total Lines 15
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 15
rs 8.8571
c 0
b 0
f 0
cc 5
eloc 9
nc 8
nop 2
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\Server\AuthorizationEndpoint\ParameterChecker;
15
16
use OAuth2Framework\Component\Server\AuthorizationEndpoint\Authorization;
17
18
/**
19
 * Class StateParameterChecker.
20
 *
21
 * @see http://tools.ietf.org/html/rfc6749#section-3.1.2
22
 */
23
final class StateParameterChecker implements ParameterChecker
24
{
25
    /**
26
     * {@inheritdoc}
27
     */
28
    public function check(Authorization $authorization): Authorization
29
    {
30
        if (true === $authorization->hasQueryParam('state')) {
31
            $authorization = $authorization->withResponseParameter('state', $authorization->getQueryParam('state'));
32
        }
33
34
        return $authorization;
35
    }
36
}
37