Skip to content

Commit

Permalink
Make isValid method private
Browse files Browse the repository at this point in the history
  • Loading branch information
danielebarbaro committed Jan 25, 2025
1 parent ea23ec9 commit d635846
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
10 changes: 5 additions & 5 deletions src/Rules/VatNumber.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@

class VatNumber implements ValidationRule
{
public function isValid(mixed $value): bool
{
return VatValidator::validate($value);
}

public function validate(string $attribute, mixed $value, \Closure $fail): void
{
if (! $this->isValid($value)) {
$fail(__('laravelVatEuValidator::validation.vat_number', ['attribute' => $attribute]));
}
}

private function isValid(mixed $value): bool
{
return VatValidator::validate($value);
}
}
10 changes: 5 additions & 5 deletions src/Rules/VatNumberExist.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@

class VatNumberExist implements ValidationRule
{
public function isValid(mixed $value): bool
{
return VatValidator::validateExistence($value);
}

public function validate(string $attribute, mixed $value, Closure $fail): void
{
if (! $this->isValid($value)) {
$fail(__('laravelVatEuValidator::validation.vat_number_exist', ['attribute' => $attribute]));
}
}

private function isValid(mixed $value): bool
{
return VatValidator::validateExistence($value);
}
}
10 changes: 5 additions & 5 deletions src/Rules/VatNumberFormat.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@

class VatNumberFormat implements ValidationRule
{
public function isValid(mixed $value): bool
{
return VatValidator::validateFormat($value);
}

public function validate(string $attribute, mixed $value, \Closure $fail): void
{
if (! $this->isValid($value)) {
$fail(__('laravelVatEuValidator::validation.vat_number_format', ['attribute' => $attribute]));
}
}

private function isValid(mixed $value): bool
{
return VatValidator::validateFormat($value);
}
}

0 comments on commit d635846

Please sign in to comment.