This class seems to be duplicated in your project.
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.
Loading history...
10
{
11
12
/**
13
* @var \DoliDB
14
*/
15
private $db;
16
17
/**
18
* @param $db
19
*/
20
public function __construct($db)
21
{
22
$this->db = $db;
23
}
24
25
/**
26
* @param int $year
27
*
28
* @return TotalDamage[]|array
29
*/
30
public function query($year)
31
{
32
$sql = 'SELECT SUM(damage.amount) as total_amount, damage.author_id as author';
33
$sql.=' FROM '.MAIN_DB_PREFIX.'bbc_flight_damages as damage';
34
$sql.=' INNER JOIN '.MAIN_DB_PREFIX.'bbc_vols as flight ON flight.rowid = damage.flight_id';
35
$sql.=' WHERE YEAR(flight.date) = '.$this->db->escape($year);
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.