aboutsummaryrefslogtreecommitdiff
path: root/app/Models/StatsDAO.php
diff options
context:
space:
mode:
authorGravatar Luc SANCHEZ <4697568+ColonelMoutarde@users.noreply.github.com> 2024-11-28 17:11:04 +0100
committerGravatar GitHub <noreply@github.com> 2024-11-28 17:11:04 +0100
commit15745d42b779ad14efde2932ab116f45eee39246 (patch)
tree2528a36184d8152d4f2d90dc73df680f84bbe1d1 /app/Models/StatsDAO.php
parent604b186638276203c8495a3ee86da0cc240ab4d0 (diff)
Upgrade code to php 8.1 (#6748)
* revert Fix code indentation Fix code Upgrade code to php 8.1 * fix remarques * code review * code review * code review * Apply suggestions from code review * code review * Fixes * Many remainging updates of array syntax * Lost case 'reading-list' * Uneeded PHPDoc --------- Co-authored-by: Luc Sanchez <l.sanchez-prestataire@alptis.fr> Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
Diffstat (limited to 'app/Models/StatsDAO.php')
-rw-r--r--app/Models/StatsDAO.php19
1 files changed, 6 insertions, 13 deletions
diff --git a/app/Models/StatsDAO.php b/app/Models/StatsDAO.php
index c9753cf2c..6782bd7ee 100644
--- a/app/Models/StatsDAO.php
+++ b/app/Models/StatsDAO.php
@@ -147,19 +147,12 @@ SQL;
if ($res == false) {
return [];
}
- switch ($period) {
- case '%H':
- $periodMax = 24;
- break;
- case '%w':
- $periodMax = 7;
- break;
- case '%m':
- $periodMax = 12;
- break;
- default:
- $periodMax = 30;
- }
+ $periodMax = match ($period) {
+ '%H' => 24,
+ '%w' => 7,
+ '%m' => 12,
+ default => 30,
+ };
$repartition = array_fill(0, $periodMax, 0);
foreach ($res as $value) {