Passed
Push — master ( 74410d...2144d7 )
by Nicolas
07:08 queued 10s
created

GameRelease::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 24
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 11
nc 1
nop 11
dl 0
loc 24
rs 9.9
c 0
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
namespace AL\Common\Model\Game;
3
4
/**
5
 * Maps to the `game_release` table
6
 */
7
class GameRelease {
8
    private $id;
9
    private $game_id;
10
    private $name;
11
    private $date;
12
    private $license;
13
    private $type;
14
    private $publisher;
15
    private $status;
16
    private $hd_installable;
17
    private $notes;
18
    private $menu;
19
20
    public function __construct(
21
        $id,
22
        $game_id,
23
        $name,
24
        $date,
25
        $license,
26
        $type,
27
        $publisher,
28
        $status,
29
        $hd_installable,
30
        $notes,
31
        $menu
32
    ) {
33
        $this->id = $id;
34
        $this->game_id = $game_id;
35
        $this->name = $name;
36
        $this->date = $date;
37
        $this->license = $license;
38
        $this->type = $type;
39
        $this->publisher = $publisher;
40
        $this->status = $status;
41
        $this->hd_installable = $hd_installable;
42
        $this->notes = $notes;
43
        $this->menu = trim($menu);
44
    }
45
46
    public function getId() {
47
        return $this->id;
48
    }
49
50
    public function getGameId() {
51
        return $this->game_id;
52
    }
53
54
    public function getDate() {
55
        return $this->date;
56
    }
57
58
    public function getName() {
59
        return $this->name;
60
    }
61
62
    public function getLicense() {
63
        return $this->license;
64
    }
65
66
    public function getType() {
67
        return $this->type;
68
    }
69
70
    public function getPublisher() {
71
        return $this->publisher;
72
    }
73
74
    public function getStatus() {
75
        return $this->status;
76
    }
77
78
    public function getHdInstallable() {
79
        return $this->hd_installable;
80
    }
81
82
    public function getNotes() {
83
        return $this->notes;
84
    }
85
86
    public function getMenu() {
87
        return $this->menu;
88
    }
89
}
90