AbstractAuthorizeGrant   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 15
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A makeRedirectUri() 0 5 2
A createAuthorizationRequest() 0 3 1
1
<?php
2
3
/**
4
 * Abstract authorization grant.
5
 *
6
 * @author      Julián Gutiérrez <[email protected]>
7
 * @copyright   Copyright (c) Alex Bilbie
8
 * @license     http://mit-license.org/
9
 *
10
 * @link        https://github.com/thephpleague/oauth2-server
11
 */
12
13
declare(strict_types=1);
14
15
namespace League\OAuth2\Server\Grant;
16
17
use League\OAuth2\Server\RequestTypes\AuthorizationRequest;
18
use League\OAuth2\Server\RequestTypes\AuthorizationRequestInterface;
19
20
use function http_build_query;
21
use function strstr;
22
23
abstract class AbstractAuthorizeGrant extends AbstractGrant
24
{
25
    /**
26
     * @param mixed[] $params
27
     */
28 8
    public function makeRedirectUri(string $uri, array $params = [], string $queryDelimiter = '?'): string
29
    {
30 8
        $uri .= (strstr($uri, $queryDelimiter) === false) ? $queryDelimiter : '&';
31
32 8
        return $uri . http_build_query($params);
33
    }
34
35 9
    protected function createAuthorizationRequest(): AuthorizationRequestInterface
36
    {
37 9
        return new AuthorizationRequest();
38
    }
39
}
40