32 lines
757 B
PHP
32 lines
757 B
PHP
|
<?php
|
||
|
|
||
|
class ValidationStatus extends SplEnum
|
||
|
{
|
||
|
const __default = self::NOT_READY;
|
||
|
|
||
|
const NOT_READY = 0;
|
||
|
const WAITING = 1;
|
||
|
const VALIDATED = 2;
|
||
|
|
||
|
public function getName() {
|
||
|
switch ($this) {
|
||
|
case self::WAITING:
|
||
|
return "En attente de validation";
|
||
|
case self::VALIDATED:
|
||
|
return "Inscription validée";
|
||
|
default:
|
||
|
return "Inscription non terminée";
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public static function fromName($name) {
|
||
|
switch ($name) {
|
||
|
case "WAITING":
|
||
|
return self::WAITING;
|
||
|
case "VALIDATED":
|
||
|
return self::VALIDATED;
|
||
|
default:
|
||
|
return self::NOT_READY;
|
||
|
}
|
||
|
}
|
||
|
}
|