Test Failed
Branch main (fda838)
by Rafael
50:22
created

CommonObject::setValueFrom()   F

Complexity

Conditions 35
Paths > 20000

Size

Total Lines 119
Code Lines 77

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 35
eloc 77
nc 759936
nop 9
dl 0
loc 119
rs 0
c 0
b 0
f 0

How to fix   Long Method    Complexity    Many Parameters   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

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
/* Copyright (C) 2006-2015  Laurent Destailleur <[email protected]>
4
 * Copyright (C) 2005-2013  Regis Houssin       <[email protected]>
5
 * Copyright (C) 2010-2020  Juanjo Menent       <[email protected]>
6
 * Copyright (C) 2012-2013  Christophe Battarel <[email protected]>
7
 * Copyright (C) 2011-2022  Philippe Grand      <[email protected]>
8
 * Copyright (C) 2012-2015  Marcos García       <[email protected]>
9
 * Copyright (C) 2012-2015  Raphaël Doursenaud  <[email protected]>
10
 * Copyright (C) 2012       Cedric Salvador     <[email protected]>
11
 * Copyright (C) 2015-2022  Alexandre Spangaro  <[email protected]>
12
 * Copyright (C) 2016       Bahfir abbes        <[email protected]>
13
 * Copyright (C) 2017       ATM Consulting      <[email protected]>
14
 * Copyright (C) 2017-2019  Nicolas ZABOURI     <[email protected]>
15
 * Copyright (C) 2017       Rui Strecht         <[email protected]>
16
 * Copyright (C) 2018-2024  Frédéric France     <[email protected]>
17
 * Copyright (C) 2018       Josep Lluís Amador  <[email protected]>
18
 * Copyright (C) 2023       Gauthier VERDOL     <[email protected]>
19
 * Copyright (C) 2021       Grégory Blémand     <[email protected]>
20
 * Copyright (C) 2023       Lenin Rivas      	<[email protected]>
21
 * Copyright (C) 2024		MDW					<[email protected]>
22
 * Copyright (C) 2024       Rafael San José     <[email protected]>
23
 *
24
 * This program is free software; you can redistribute it and/or modify
25
 * it under the terms of the GNU General Public License as published by
26
 * the Free Software Foundation; either version 3 of the License, or
27
 * (at your option) any later version.
28
 *
29
 * This program is distributed in the hope that it will be useful,
30
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
31
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
32
 * GNU General Public License for more details.
33
 *
34
 * You should have received a copy of the GNU General Public License
35
 * along with this program. If not, see <https://www.gnu.org/licenses/>.
36
 */
37
38
/**
39
 *  \file       htdocs/core/class/commonobject.class.php
40
 *  \ingroup    core
41
 *  \brief      File of parent class of all other business classes (invoices, contracts, proposals, orders, ...)
42
 *
43
 * Replaced by Deprecated/Core/Base/GenericDocument.php
44
 */
45