| Numéro du ticket | Titre du ticket | |------------------|-----------------| | #322 | Page horaire | ## Description de la PR [#322] Page horaire ## Modification du .env ## Check list - [ ] Pas de régression - [ ] TU/TI/TF rédigée - [ ] TU/TI/TF OK - [ ] CHANGELOG modifié Reviewed-on: #4 Co-authored-by: tristan <tristan@yuno.malio.fr> Co-committed-by: tristan <tristan@yuno.malio.fr>
This commit was merged in pull request #4.
This commit is contained in:
47
src/Enum/ContractType.php
Normal file
47
src/Enum/ContractType.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Enum;
|
||||
|
||||
enum ContractType: string
|
||||
{
|
||||
case FORFAIT = 'FORFAIT';
|
||||
case H35 = '35H';
|
||||
case H39 = '39H';
|
||||
case INTERIM = 'INTERIM';
|
||||
case CUSTOM = 'CUSTOM';
|
||||
|
||||
public static function resolve(?string $name, ?string $trackingMode, ?int $weeklyHours): self
|
||||
{
|
||||
if (TrackingMode::PRESENCE->value === $trackingMode) {
|
||||
return self::FORFAIT;
|
||||
}
|
||||
|
||||
$normalizedName = self::normalize($name);
|
||||
if ('interim' === $normalizedName) {
|
||||
return self::INTERIM;
|
||||
}
|
||||
|
||||
if (35 === $weeklyHours) {
|
||||
return self::H35;
|
||||
}
|
||||
|
||||
if (39 === $weeklyHours) {
|
||||
return self::H39;
|
||||
}
|
||||
|
||||
return self::CUSTOM;
|
||||
}
|
||||
|
||||
private static function normalize(?string $value): string
|
||||
{
|
||||
if (null === $value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$normalized = mb_strtolower(trim($value));
|
||||
|
||||
return str_replace('é', 'e', $normalized);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user