Failed Conditions
Push — master ( aacec5...b5a0b4 )
by Florent
04:50
created

AuthorizationCode::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 9

How to fix   Many Parameters   

Many Parameters

Methods with many parameters are not only hard to understand, but their parameters also often become inconsistent when you need more, or different data.

There are several approaches to avoid long parameter lists:

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\AuthorizationCodeGrant\Tests;
15
16
use OAuth2Framework\Component\AuthorizationCodeGrant\AbstractAuthorizationCode;
17
use OAuth2Framework\Component\AuthorizationCodeGrant\AuthorizationCodeId;
18
use OAuth2Framework\Component\Core\Client\ClientId;
19
use OAuth2Framework\Component\Core\DataBag\DataBag;
20
use OAuth2Framework\Component\Core\ResourceServer\ResourceServerId;
21
use OAuth2Framework\Component\Core\UserAccount\UserAccountId;
22
23
final class AuthorizationCode extends AbstractAuthorizationCode
24
{
25
    /**
26
     * @var AuthorizationCodeId
27
     */
28
    private $id;
29
30
    public function __construct(AuthorizationCodeId $id, ClientId $clientId, UserAccountId $userAccountId, array $queryParameters, string $redirectUri, \DateTimeImmutable $expiresAt, DataBag $parameter, DataBag $metadata, ?ResourceServerId $resourceServerId)
31
    {
32
        parent::__construct($clientId, $userAccountId, $queryParameters, $redirectUri, $expiresAt, $parameter, $metadata, $resourceServerId);
33
        $this->id = $id;
34
    }
35
36
    public function getId(): AuthorizationCodeId
37
    {
38
        return $this->id;
39
    }
40
}
41