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

CommonInvoice   F

Complexity

Total Complexity 225

Size/Duplication

Total Lines 1787
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 921
dl 0
loc 1787
rs 1.679
c 0
b 0
f 0
wmc 225

How to fix   Complexity   

Complex Class

Complex classes like CommonInvoice often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

While breaking up the class, it is a good idea to analyze how other classes use CommonInvoice, and based on these observations, apply Extract Interface, too.

1
<?php
2
3
/* Copyright (C) 2012       Regis Houssin           <[email protected]>
4
 * Copyright (C) 2012       Cédric Salvador         <[email protected]>
5
 * Copyright (C) 2012-2014  Raphaël Doursenaud      <[email protected]>
6
 * Copyright (C) 2023		Nick Fragoulis
7
 * Copyright (C) 2024       Frédéric France         <[email protected]>
8
 * Copyright (C) 2024		MDW						<[email protected]>
9
 * Copyright (C) 2024       Rafael San José         <[email protected]>
10
 *
11
 * This program is free software; you can redistribute it and/or modify
12
 * it under the terms of the GNU General Public License as published by
13
 * the Free Software Foundation; either version 3 of the License, or
14
 * (at your option) any later version.
15
 *
16
 * This program is distributed in the hope that it will be useful,
17
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
 * GNU General Public License for more details.
20
 *
21
 * You should have received a copy of the GNU General Public License
22
 * along with this program. If not, see <https://www.gnu.org/licenses/>.
23
 */
24
25
/**
26
 *       \file       htdocs/core/class/commoninvoice.class.php
27
 *       \ingroup    core
28
 *       \brief      File of the superclass of invoices classes (customer and supplier)
29
 *
30
 * Replaced by Deprecated/Modules/Billing/Model/CommonInvoice.php
31
 */
32