RecurringDowntime Class Reference

RecurringDowntime class. More...

Inheritance diagram for RecurringDowntime:
Downtime

Public Member Functions

 __construct ($model)
 Provides a helpers for working with recurring downtime.
 is_excluded ($target_date)
 Checks if the given $target_date is excluded.
 match_day_of_month ($target_date)
 Returns true if the given date matches the relative occurrence of the schedule.
 pluck_recurrence ($key)
 Plucks values by key from a map.
 match_year_interval ($target_date)
 Checks if the provided $date's year matches the schedule's stepping.
 match_month_interval ($target_date)
 Checks if the provided $date's month matches the schedule's stepping.
 match_week_interval ($target_date)
 Checks if the provided $date's week matches the schedule's stepping.
 match_day_interval ($target_date)
 Checks if the provided $date's day matches the schedule's stepping.

Data Fields

 $recurrence
 object recurrence object
 $recurrence_on
 array nested recurrence map
 $recurrence_ends
 NinjaDateTime.
 $exclude_days
 array

Detailed Description

RecurringDowntime class.

Used with recurring schedules, inherits from Downtime.


Constructor & Destructor Documentation

RecurringDowntime::__construct ( model  ) 

Provides a helpers for working with recurring downtime.

Parameters:
$model object
Exceptions:
Exception UnexpectedValueException
NoRecurrenceException 

Reimplemented from Downtime.


Member Function Documentation

RecurringDowntime::is_excluded ( target_date  ) 

Checks if the given $target_date is excluded.

The input, $target_date, is a NinjaDateTime object or--to simplify testing--a parsable date string, that is compared against an array of ranges or single dates contained in `$this->exclude_days`: ['2019-03-13 to 2019-03-16', '2019-03-13 to 2019-03-18', ...]

Parameters:
$target_date mixed NinjaDateTime|str
Returns:
bool
Exceptions:
Exception UnexpectedValueException Invalid date-exclusion format
RecurringDowntime::match_day_interval ( target_date  ) 

Checks if the provided $date's day matches the schedule's stepping.

Parameters:
$target_date NinjaDateTime
Returns:
bool
Exceptions:
Exception UnexpectedValueException
RecurringDowntime::match_day_of_month ( target_date  ) 

Returns true if the given date matches the relative occurrence of the schedule.

if [target_date] is on [occurrence] [weekday] : return true

Parameters:
$target_date NinjaDateTime
Returns:
boolean
Exceptions:
Exception UnexpectedValueException
RecurringDowntime::match_month_interval ( target_date  ) 

Checks if the provided $date's month matches the schedule's stepping.

Parameters:
$target_date NinjaDateTime
Returns:
bool
Exceptions:
Exception UnexpectedValueException
RecurringDowntime::match_week_interval ( target_date  ) 

Checks if the provided $date's week matches the schedule's stepping.

Parameters:
$target_date NinjaDateTime
Returns:
bool
Exceptions:
Exception UnexpectedValueException
RecurringDowntime::match_year_interval ( target_date  ) 

Checks if the provided $date's year matches the schedule's stepping.

Parameters:
$target_date NinjaDateTime
Returns:
bool
Exceptions:
Exception UnexpectedValueException
RecurringDowntime::pluck_recurrence ( key  ) 

Plucks values by key from a map.

input: 'day'

recurrence_on: ['day' => 1, 'day' => 2, 'day' => 3]

output: [1, 2, 3]

Parameters:
$key string The key to pluck
Returns:
array plucked items

The documentation for this class was generated from the following file:
 All Data Structures Functions Variables

Generated on 18 May 2020 for ninja by  doxygen 1.6.1