70d4767890
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
31 lines
548 B
PHP
31 lines
548 B
PHP
<?php
|
|
|
|
namespace App\Services;
|
|
|
|
class StressCalculator
|
|
{
|
|
public const LEVEL_HIGH = 'Élevé';
|
|
|
|
public const LEVEL_MODERATE = 'Modéré';
|
|
|
|
public const LEVEL_LOW = 'Faible';
|
|
|
|
public function calculateScore(array $points): int
|
|
{
|
|
return array_sum($points);
|
|
}
|
|
|
|
public function determineLevel(int $score): string
|
|
{
|
|
if ($score >= 300) {
|
|
return self::LEVEL_HIGH;
|
|
}
|
|
|
|
if ($score >= 150) {
|
|
return self::LEVEL_MODERATE;
|
|
}
|
|
|
|
return self::LEVEL_LOW;
|
|
}
|
|
}
|