File tree Expand file tree Collapse file tree
src/Illuminate/Console/Scheduling Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -624,6 +624,21 @@ public function getSummaryForDisplay()
624624 return $ this ->buildCommand ();
625625 }
626626
627+ /**
628+ * Determine the next due date for an event.
629+ *
630+ * @param \DateTime|string $currentTime
631+ * @param int $nth
632+ * @param bool $allowCurrentDate
633+ * @return \Carbon\Carbon
634+ */
635+ public function nextRunDate ($ currentTime = 'now ' , $ nth = 0 , $ allowCurrentDate = false )
636+ {
637+ return Carbon::instance ($ nextDue = CronExpression::factory (
638+ $ this ->getExpression ()
639+ )->getNextRunDate ($ currentTime , $ nth , $ allowCurrentDate ));
640+ }
641+
627642 /**
628643 * Get the Cron expression for the event.
629644 *
@@ -646,20 +661,4 @@ public function preventOverlapsUsing(Mutex $mutex)
646661
647662 return $ this ;
648663 }
649-
650- /**
651- * Determine next due date for Event.
652- * @param DateTime|string $currentTime Relative calculation date
653- * @param int $nth Number of matches to skip before returning a matching next run date
654- * @param bool $allowCurrentDate Return the current date if it matches the cron expression.
655- * @return Carbon
656- */
657- public function nextDue ($ currentTime = 'now ' , $ nth = 0 , $ allowCurrentDate = false )
658- {
659- $ nextDue = CronExpression::factory (
660- $ this ->getExpression ()
661- )->getNextRunDate ($ currentTime , $ nth , $ allowCurrentDate );
662-
663- return Carbon::instance ($ nextDue );
664- }
665664}
Original file line number Diff line number Diff line change @@ -56,11 +56,11 @@ public function testBuildCommandAppendOutput()
5656 $ this ->assertSame ("php -i >> {$ quote }/dev/null {$ quote } 2>&1 " , $ event ->buildCommand ());
5757 }
5858
59- public function testNextDue ()
59+ public function testNextRunDate ()
6060 {
6161 $ event = new Event (m::mock ('Illuminate\Console\Scheduling\Mutex ' ), 'php -i ' );
6262 $ event ->dailyAt ('10:15 ' );
6363
64- $ this ->assertSame ('10:15:00 ' , $ event ->nextDue ()->toTimeString ());
64+ $ this ->assertSame ('10:15:00 ' , $ event ->nextRunDate ()->toTimeString ());
6565 }
6666}
You can’t perform that action at this time.
0 commit comments