code: protected function formatEnumValue($value, $rule)
      {
          if (!in_array($value, $rule['range'])) {
              throw new BadRequest(
                  T('{name} should be in {range}, but now {name} = {value}',
                      ['name' => $rule['name'], 'range' => implode('/', $rule['range']), 'value' => $value])
              );
          }
      }
docs: 格式化枚举类型
  
  @param string $value 变量值
  @param array $rule ['name' => '', 'type' => 'enum', 'default' => '', 'range' => []]
  @throws BadRequest