Skip to content

Commit

Permalink
Ajustes de códigos
Browse files Browse the repository at this point in the history
  • Loading branch information
dliocode committed Dec 24, 2021
1 parent 10a0447 commit ff0ef7a
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/core/DataValidator.Context.pas
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ function TDataValidatorContext<T>.IsLatLong(const ACheckDMS: Boolean): T;
Result := Add(TValidatorIsLatLong.Create(ACheckDMS, 'Value is not JWT (JSON Web Token)!'));
end;

function TDataValidatorContext<T>.IsLength(const AMin, AMax: Integer): T;
function TDataValidatorContext<T>.IsLength(const AMin: Integer; const AMax: Integer): T;
begin
Result := Add(TValidatorIsLength.Create(AMin, AMax, Format('Value required length min(%d) and max(%d)!', [AMin, AMax])));
end;
Expand Down
4 changes: 2 additions & 2 deletions src/core/DataValidator.Information.pas
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ constructor TDataValidatorInformations.Create;
destructor TDataValidatorInformations.Destroy;
begin
FList.Clear;
FList.DisposeOf;
FList.Free;

inherited;
end;
Expand Down Expand Up @@ -126,7 +126,7 @@ function TDataValidatorInformations.Message: string;

Result := Trim(LSL.Text);
finally
LSL.DisposeOf
LSL.Free
end;
end;

Expand Down
2 changes: 1 addition & 1 deletion src/core/DataValidator.Value.pas
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ constructor TDataValidatorValue.Create;
destructor TDataValidatorValue.Destroy;
begin
FList.Clear;
FList.DisposeOf;
FList.Free;

inherited;
end;
Expand Down
21 changes: 9 additions & 12 deletions src/validators/Validator.Custom.pas
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,15 @@ function TValidatorCustom.Check: IDataValidatorResult;
LValue := GetValueAsString;
R := False;

try
if Assigned(FCustomExecute) then
R := FCustomExecute(LValue)
else
if Assigned(FCustomMessageExecute) then
begin
LMessage := GetMessage;
R := FCustomMessageExecute(LValue, LMessage);
SetMessage(LMessage);
end;
except
end;
if Assigned(FCustomExecute) then
R := FCustomExecute(LValue)
else
if Assigned(FCustomMessageExecute) then
begin
LMessage := GetMessage;
R := FCustomMessageExecute(LValue, LMessage);
SetMessage(LMessage);
end;

if FIsNot then
R := not R;
Expand Down
2 changes: 1 addition & 1 deletion src/validators/Validator.IsJWT.pas
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ function TValidatorIsJWT.Check: IDataValidatorResult;
R := (LJSONValue as TJSONObject).TryGetValue<string>('alg', LJSONObjectValue);
finally
if Assigned(LJSONValue) then
LJSONValue.DisposeOf;
LJSONValue.Free;
end;

if not R then
Expand Down
2 changes: 1 addition & 1 deletion src/validators/Validator.IsPort.pas
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ interface

uses
DataValidator.ItemBase,
System.Math, System.SysUtils;
System.SysUtils;

type
TValidatorIsPort = class(TDataValidatorItemBase, IDataValidatorItem)
Expand Down

0 comments on commit ff0ef7a

Please sign in to comment.