public function filterEnum($value, $enumName)
    {
        if (!isset($this->enums[$enumName])) {
            throw new InvalidParamException("The '$enumName' enum has not been registered in the current formatter");
        }
        if ($value === null) {
            return null;
        }
        return ($key = array_search($value, $this->enums[$enumName])) !== null ? $key : null;
    }