Skip to content

Commit

Permalink
Add validateMinute()
Browse files Browse the repository at this point in the history
  • Loading branch information
shaedrich authored Dec 20, 2024
1 parent bd335c2 commit 5286ad4
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/Illuminate/Console/Scheduling/ValidatesFrequencies.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use InvalidArgumentException;

use const Illuminate\Support\Date\{DAYS_PER_WEEK, HOURS_PER_DAY, MONTHS_PER_YEAR};
use const Illuminate\Support\Date\{DAYS_PER_WEEK, HOURS_PER_DAY, MINUTES_PER_HOUR, MONTHS_PER_YEAR};

trait ValidatesFrequencies
{
Expand All @@ -18,6 +18,16 @@ protected function validateHour(int $hour)
}
}

/**
* @param int $minute
*/
protected function validateMinute(int $minute)
{
if ($minute < 0 || $minute > MINUTES_PER_HOUR) {
throw new InvalidArgumentException('Minute cron expression component must be between 0 and '.MINUTES_PER_HOUR.". [$minute] given");
}
}

/**
* @param int $dayOfWeek
*/
Expand All @@ -44,7 +54,7 @@ protected function validateMonth(int $month)
protected function validateDayOfMonth(int|string $dayOfMonth)
{
if (is_string($dayOfMonth)) {
return;
return;
}

if ($dayOfMonth < 0 || $dayOfMonth > 31) {
Expand Down

0 comments on commit 5286ad4

Please sign in to comment.