SecondFactor::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 31
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 8
dl 0
loc 31
rs 10
c 1
b 0
f 0

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
/**
4
 * Copyright 2014 SURFnet bv
5
 *
6
 * Licensed under the Apache License, Version 2.0 (the "License");
7
 * you may not use this file except in compliance with the License.
8
 * You may obtain a copy of the License at
9
 *
10
 *     http://www.apache.org/licenses/LICENSE-2.0
11
 *
12
 * Unless required by applicable law or agreed to in writing, software
13
 * distributed under the License is distributed on an "AS IS" BASIS,
14
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
 * See the License for the specific language governing permissions and
16
 * limitations under the License.
17
 */
18
19
namespace Surfnet\StepupMiddleware\GatewayBundle\Entity;
20
21
use Doctrine\ORM\Mapping as ORM;
22
use Ramsey\Uuid\Uuid;
23
use Surfnet\StepupMiddleware\GatewayBundle\Repository\SecondFactorRepository;
24
25
/**
26
 * WARNING: Any schema change made to this entity should also be applied to the Gateway SecondFactor entity!
27
 * @see Surfnet\StepupGateway\GatewayBundle\Entity\SecondFactor (in OpenConext/Stepup-Gateway project)
28
 *
29
 * @SuppressWarnings("PHPMD.UnusedPrivateFields")
30
 */
31
#[ORM\Table]
32
#[ORM\Index(name: 'idx_secondfactor_nameid', columns: ['name_id'])]
33
#[ORM\Entity(repositoryClass: SecondFactorRepository::class)]
34
class SecondFactor
35
{
36
    #[ORM\Id]
37
    #[ORM\Column(length: 36)]
38
    private string $id;
39
40
    public function __construct(
41
        #[ORM\Id]
42
        #[ORM\Column(length: 36)]
43
        private string $identityId,
44
        #[ORM\Column(length: 200)]
45
        private string $nameId,
46
        #[ORM\Column(length: 200)]
47
        private string $institution,
48
        /**
49
         * In which language to display any second factor verification screens.
50
         */
51
        #[ORM\Column]
52
        public string $displayLocale,
53
        #[ORM\Column(length: 36)]
54
        private string $secondFactorId,
55
        #[ORM\Column(length: 255)]
56
        private string $secondFactorIdentifier,
57
        #[ORM\Column(length: 50)]
58
        private string $secondFactorType,
59
        /**
60
         * This boolean indicates if the second factor token was vetted
61
         * using one of the vetting types that are considered 'identity-vetted'.
62
         * That in turn means if the owner of the second factor token has its
63
         * identity vetted (verified) by a RA(A) at the service desk. This trickles
64
         * down to the self-vet vetting type. As the token used for self vetting
65
         * was RA vetted.
66
         */
67
        #[ORM\Column(type: 'boolean', options: ['default' => '1'])]
68
        private bool $identityVetted,
69
    ) {
70
        $this->id = (string)Uuid::uuid4();
71
    }
72
}
73