Files
myep-team/src/Enum/QuestionType.php
T

36 lines
1.1 KiB
PHP

<?php
namespace App\Enum;
/**
* The kinds of question a questionnaire definition may use. Each maps to exactly one form field
* in QuestionnaireType; adding one means a case here and a line there, nothing more.
*
* TEAMER_GUIDINGS, TEAMER_COURSES and PROGRAMME are the house manager's bespoke widgets: their
* options are the guiding types, course types and programme items, and each picked option carries
* numbers of its own. The two teamer types offer the travel's placements, so they need the form's
* `travel` option.
*/
enum QuestionType: string
{
case TEXT = 'text';
case TEXTAREA = 'textarea';
case CHOICE = 'choice';
case MULTI = 'multi';
case DATE = 'date';
case RATING = 'rating';
case TEAMER_GUIDINGS = 'teamer_guidings';
case TEAMER_COURSES = 'teamer_courses';
case PROGRAMME = 'programme';
public function hasOptions(): bool
{
return self::TEXT !== $this && self::TEXTAREA !== $this && self::DATE !== $this && self::RATING !== $this;
}
public function needsTravel(): bool
{
return self::TEAMER_GUIDINGS === $this || self::TEAMER_COURSES === $this;
}
}