src/Request/Formatter/BaseFormatter.php
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])
            );
        }
    }
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])
            );
        }
    }
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 ] ) ) ; } }
格式化枚举类型

@param string $value 变量值
@param array $rule ['name' => '', 'type' => 'enum', 'default' => '', 'range' => []]
@throws BadRequest
格式化枚举类型