Passed
Push — master ( e88490...575397 )
by Alexandre
04:15
created

AuthorizationCode::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 8

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
 * Created by PhpStorm.
4
 * User: Alexandre
5
 * Date: 17/03/2018
6
 * Time: 13:50
7
 */
8
9
namespace OAuth2\Extensions\OpenID\Credentials;
10
11
12
class AuthorizationCode extends \OAuth2\Credentials\AuthorizationCode implements AuthorizationCodeInterface
13
{
14
15
    /**
16
     * @var string|null
17
     */
18
    protected $idToken;
19
20
    public function __construct(string $code, string $scope, string $clientIdentifier, string $resourceOwnerIdentifier,
21
                                int $expiresAt, ?string $requestedScope = null, ?string $redirectUri = null,
22
                                ?string $idToken = null)
23
    {
24
        parent::__construct($code, $scope, $clientIdentifier, $resourceOwnerIdentifier,
25
            $expiresAt, $requestedScope, $redirectUri);
26
        $this->idToken = $idToken;
27
    }
28
29
    public function getIdToken(): ?string
30
    {
31
        return $this->idToken;
32
    }
33
34
    /**
35
     * @param null|string $idToken
36
     */
37
    public function setIdToken(?string $idToken): void
38
    {
39
        $this->idToken = $idToken;
40
    }
41
}