Piwik\Scheduler\Schedule\

Monthly

Monthly class is used to schedule tasks every month.

Methods

The class defines the following methods:

  • setHour() ash; Sets the hour of the day on which the task should be executed. Inherited from Schedule
  • factory() ash; Returns a new Schedule instance using a string description of the scheduled period type and a string description of the day within the period to execute the task on. Inherited from Schedule

setHour()

Sets the hour of the day on which the task should be executed.

Signature

  • It accepts the following parameter(s):
    • $hour (int) — Must be >= 0 and < 24.
  • It does not return anything or a mixed result.
  • It throws one of the following exceptions:
    • Exception — If the current scheduled period is hourly or if $hour is invalid.

factory()

Returns a new Schedule instance using a string description of the scheduled period type and a string description of the day within the period to execute the task on.

Signature

  • It accepts the following parameter(s):

    • $periodType (string) — The scheduled period type. Can be 'hourly', 'daily', 'weekly', or 'monthly'.
    • $periodDay (bool|false|int|string) — A string describing the day within the scheduled period to execute the task on. Only valid for week and month periods. If 'weekly' is supplied for $periodType, this should be a day of the week, for example, 'monday' or 'tuesday'. If 'monthly' is supplied for $periodType, this can be a numeric day in the month or a day in one week of the month. For example, 12, 23, 'first sunday' or 'fourth tuesday'.
  • Returns: Hourly|Daily|Weekly|Monthly

  • It throws one of the following exceptions: