UserContact::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 29
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 15
CRAP Score 1

Importance

Changes 4
Bugs 0 Features 1
Metric Value
eloc 14
c 4
b 0
f 1
dl 0
loc 29
rs 9.7998
ccs 15
cts 15
cp 1
cc 1
nc 1
nop 14
crap 1

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
namespace Azine\HybridAuthBundle\Entity;
4
5
class UserContact
6
{
7
    /* The Unique contact user ID */
8
    public $identifier = null;
9
10
    /* User website, blog, web page */
11
    public $webSiteURL = null;
12
13
    /* URL link to profile page on the IDp web site */
14
    public $profileURL = null;
15
16
    /* URL link to user photo or avatar */
17
    public $photoURL = null;
18
19
    /* Url link to user photo or avatar (bigger)*/
20
    public $photoUrlBig = null;
21
22
    /* Gender */
23
    public $gender = null;
24
25
    /* The users last name */
26
    public $firstName = null;
27
28
    /* The users first name */
29
    public $lastName = null;
30
31
    /* User displayName provided by the IDp or a concatenation of first and last name */
32
    public $displayName = null;
33
34
    /* A short about_me */
35
    public $description = null;
36
37
    /* The users primary work-company */
38
    public $company = null;
39
40
    /* the users title */
41
    public $title = null;
42
43
    /* User email. Not all of IDp grant access to the user email */
44
    public $email = null;
45
46
    /* Prvider id */
47
    public $provider = null;
48
49
    /* For Xing & LinkedIn usually job-title @ main company */
50
    public $headline = null;
51
52
    /* array of tags associated with this user. Null if not yet loaded. */
53
    public $tags = null;
54
55
    /**
56
     * @param $provider
57
     * @param string | null $gender
58
     * @param string | null $firstName
59
     * @param string | null $lastName
60
     * @param string | null $identifier
61
     * @param string | null $webSiteURL
62
     * @param string | null $profileURL
63
     * @param string | null $photoURL
64
     * @param string | null $description
65
     * @param string | null $email
66
     * @param string | null $headline
67
     * @param array | null  $tags        array of strings
68
     */
69 1
    public function __construct($provider,
70
                                $gender = null,
71
                                $firstName = null,
72
                                $lastName = null,
73
                                $identifier = null,
74
                                $webSiteURL = null,
75
                                $profileURL = null,
76
                                $photoURL = null,
77
                                $description = null,
78
                                $email = null,
79
                                $headline = null,
80
                                $company = null,
81
                                $title = null,
82
                                array $tags = null
83
                            ) {
84 1
        $this->provider = $provider;
85 1
        $this->firstName = $firstName;
86 1
        $this->lastName = $lastName;
87 1
        $this->identifier = $identifier;
88 1
        $this->webSiteURL = $webSiteURL;
89 1
        $this->profileURL = $profileURL;
90 1
        $this->photoURL = $photoURL;
91 1
        $this->displayName = $firstName.' '.$lastName;
92 1
        $this->description = $description;
93 1
        $this->email = $email;
94 1
        $this->headline = $headline;
95 1
        $this->company = $company;
96 1
        $this->title = $title;
97 1
        $this->tags = $tags;
98
    }
99
}
100