Свойство | Type | Description | |
---|---|---|---|
$locale | the object's current locale | ||
$timezone | the object's current timezone | ||
$weekend_days | list of the days of the week (the index of the weekdays) that are considered weekend days. Defaults to Sunday (0) and Saturday (6), as this is globally the common standard. (0 = Sunday, 1 = Monday, etc.) | ||
$year | the object's current year |
Méthode | Description | |
---|---|---|
__construct ( integer $year, string $locale = 'en_US', Yasumi\TranslationsInterface $globalTranslations = null ) | Creates a new holiday provider (i.e. country/state). | |
addHoliday ( |
Adds a holiday to the holidays providers (i.e. country/state) list of holidays. | |
between ( DateTime $start_date, DateTime $end_date = null, boolean $equals = true ) : |
Retrieves a list of all holidays between the given start and end date. | |
count ( ) : integer | Returns the number of defined holidays (for the given country and the given year). | |
getHoliday ( $shortName ) : |
Retrieves the holiday object for the given holiday. | |
getHolidayDates ( ) : array | Gets all of the holiday dates defined by this holiday provider (for the given year). | |
getHolidayNames ( ) : array | Gets all of the holiday names defined by this holiday provider (for the given year). | |
getHolidays ( ) : |
Gets all of the holidays defined by this holiday provider (for the given year). | |
getIterator ( ) : ArrayIterator | Get an iterator for the holidays. | |
getYear ( ) : integer | Returns the current year set for this Holiday calendar. | |
isHoliday ( mixed $date ) : boolean | Determines whether a date represents a holiday or not. | |
isWorkingDay ( mixed $date ) : boolean | Determines whether a date represents a working day or not. | |
next ( $shortName ) : |
Retrieves the next date (year) the given holiday is going to take place. | |
previous ( $shortName ) : |
Retrieves the previous date (year) the given holiday took place. | |
whatWeekDayIs ( string $shortName ) : integer | On what day of the week is the given holiday? | |
whenIs ( string $shortName ) : string | On what date is the given holiday? |
Méthode | Description | |
---|---|---|
clearHolidays ( ) | Clear all holidays. | |
isHolidayNameNotEmpty ( $shortName ) : true | Checks whether the given holiday (short name) is not empty. |
Méthode | Description | |
---|---|---|
anotherTime ( integer $year, string $shortName ) : |
Determines the date of the given holiday for another year. | |
compareDates ( $dateA, $dateB ) : integer | Internal function to compare dates in order to sort them chronologically. |
public __construct ( integer $year, string $locale = 'en_US', Yasumi\TranslationsInterface $globalTranslations = null ) | ||
$year | integer | the year for which to provide holidays |
$locale | string | the locale/language in which holidays need to be represented |
$globalTranslations | Yasumi\TranslationsInterface | global translations |
public addHoliday ( |
||
$holiday | Holiday instance (representing a holiday) to be added to the internal list of holidays of this country. |
public between ( DateTime $start_date, DateTime $end_date = null, boolean $equals = true ) : |
||
$start_date | DateTime | Start date of the time frame to check against |
$end_date | DateTime | End date of the time frame to check against |
$equals | boolean | indicate whether the start and end dates should be included in the comparison |
Résultat |
public getHoliday ( $shortName ) : |
||
$shortName | string the name of the holiday. | |
Résultat | a Holiday instance for the given holiday |
public getHolidayDates ( ) : array | ||
Résultat | array | list of all holiday dates defined for the given year |
public getHolidayNames ( ) : array | ||
Résultat | array | list of all holiday names defined for the given year |
public getHolidays ( ) : |
||
Résultat | list of all holidays defined for the given year |
public getIterator ( ) : ArrayIterator | ||
Résultat | ArrayIterator | iterator for the holidays of this calendar |
protected isHolidayNameNotEmpty ( $shortName ) : true | ||
$shortName | string the name of the holiday to be checked. | |
Résultat | true | upon success, otherwise an InvalidArgumentException is thrown |
public isWorkingDay ( mixed $date ) : boolean | ||
$date | mixed | a Yasumi\Holiday or DateTime object |
Résultat | boolean | true if date represents a working day, otherwise false |
public next ( $shortName ) : |
||
$shortName | string the name of the holiday for which the next occurrence need to be retrieved. | |
Résultat | a Holiday instance for the given holiday |
public previous ( $shortName ) : |
||
$shortName | string the name of the holiday for which the previous occurrence need to be retrieved. | |
Résultat | a Holiday instance for the given holiday |
public whatWeekDayIs ( string $shortName ) : integer | ||
$shortName | string | short name of the holiday |
Résultat | integer | the index of the weekdays of the requested holiday (0 = Sunday, 1 = Monday, etc.) |
protected $weekend_days |