/**
  * Validates a value against a field type
  *
  * @param  $value    mixed  the value (reference, as option_id switches out
  *                          text for the id)
  * @param  $type     string the field type
  * @param  $field_id int    the field id
  * @param  $pageId   int    the page id  (needed by abuse filter)
  * @return bool      whether this is okay
  */
 protected function validateParam(&$value, $type, $field_id, $pageId)
 {
     # rating: int between 1 and 5 (inclusive)
     # boolean: 1 or 0
     # option_id: option exists
     # text: none
     switch ($type) {
         case 'rating':
             if (preg_match('/^(1|2|3|4|5)$/', $value)) {
                 return true;
             }
             break;
         case 'boolean':
             if (preg_match('/^(1|0)$/', $value)) {
                 return true;
             }
             break;
         case 'option_id':
             $options = ApiArticleFeedbackv5Utils::getOptions();
             if (!isset($options[$field_id])) {
                 return false;
             }
             $flip = array_flip($options[$field_id]);
             if (isset($flip[$value])) {
                 $value = $flip[$value];
                 return true;
             }
             break;
         case 'text':
             # Not actually a requirement, but I can see this being a thing,
             # not letting people post the entire text of 1984 in a comment
             # or something like that.
             global $wgArticleFeedbackv5MaxCommentLength;
             if ($wgArticleFeedbackv5MaxCommentLength > 0 && strlen($value) > $wgArticleFeedbackv5MaxCommentLength) {
                 return false;
             }
             return true;
         default:
             return false;
     }
     return false;
 }