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

CreateAuthorizationCode::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.8666
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\Command;
15
16
use OAuth2Framework\Component\AuthorizationCodeGrant\AuthorizationCodeId;
17
use OAuth2Framework\Component\Core\Client\ClientId;
18
use OAuth2Framework\Component\Core\DataBag\DataBag;
19
use OAuth2Framework\Component\Core\ResourceServer\ResourceServerId;
20
use OAuth2Framework\Component\Core\UserAccount\UserAccountId;
21
22
class CreateAuthorizationCode
23
{
24
    private $authorizationCodeId;
25
    private $clientId;
26
    private $userAccountId;
27
    private $queryParameter;
28
    private $redirectUri;
29
    private $expiresAt;
30
    private $parameter;
31
    private $metadata;
32
    private $resourceServerId;
33
34
    public function __construct(AuthorizationCodeId $authorizationCodeId, ClientId $clientId, UserAccountId $userAccountId, array $queryParameter, string $redirectUri, \DateTimeImmutable $expiresAt, DataBag $parameter, DataBag $metadata, ?ResourceServerId $resourceServerId)
35
    {
36
        $this->authorizationCodeId = $authorizationCodeId;
37
        $this->clientId = $clientId;
38
        $this->userAccountId = $userAccountId;
39
        $this->queryParameter = $queryParameter;
40
        $this->redirectUri = $redirectUri;
41
        $this->expiresAt = $expiresAt;
42
        $this->parameter = $parameter;
43
        $this->metadata = $metadata;
44
        $this->resourceServerId = $resourceServerId;
45
    }
46
47
    public function getAuthorizationCodeId(): AuthorizationCodeId
48
    {
49
        return $this->authorizationCodeId;
50
    }
51
52
    public function getClientId(): ClientId
53
    {
54
        return $this->clientId;
55
    }
56
57
    public function getUserAccountId(): UserAccountId
58
    {
59
        return $this->userAccountId;
60
    }
61
62
    public function getQueryParameter(): array
63
    {
64
        return $this->queryParameter;
65
    }
66
67
    public function getRedirectUri(): string
68
    {
69
        return $this->redirectUri;
70
    }
71
72
    public function getExpiresAt(): \DateTimeImmutable
73
    {
74
        return $this->expiresAt;
75
    }
76
77
    public function getParameter(): DataBag
78
    {
79
        return $this->parameter;
80
    }
81
82
    public function getMetadata(): DataBag
83
    {
84
        return $this->metadata;
85
    }
86
87
    public function getResourceServerId(): ?ResourceServerId
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
88
    {
89
        return $this->resourceServerId;
90
    }
91
}
92