Conditions | 1 |
Paths | 1 |
Total Lines | 5 |
Code Lines | 3 |
Lines | 5 |
Ratio | 100 % |
Changes | 0 |
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 |
||
13 | public function __construct(array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = null, Roles $roles) |
||
14 | { |
||
15 | parent::__construct($query, $request, $attributes, $cookies, $files, $server, $content); |
||
16 | $this->roles = $roles; |
||
17 | } |
||
18 | |||
45 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.