PHP 클래스 Yasumi\Provider\AbstractProvider

상속: implements Yasumi\ProviderInterface, implements Countabl\Countable, implements IteratorAggregat\IteratorAggregate
파일 보기 프로젝트 열기: azuyalabs/yasumi

보호된 프로퍼티들

프로퍼티 타입 설명
$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

공개 메소드들

메소드 설명
__construct ( integer $year, string $locale = 'en_US', Yasumi\TranslationsInterface $globalTranslations = null ) Creates a new holiday provider (i.e. country/state).
addHoliday ( Holiday $holiday ) 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 ) : BetweenFilter 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 ) : Holiday 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 ( ) : Holiday[] 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 ) : Holiday Retrieves the next date (year) the given holiday is going to take place.
previous ( $shortName ) : Holiday 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?

보호된 메소드들

메소드 설명
clearHolidays ( ) Clear all holidays.
isHolidayNameNotEmpty ( $shortName ) : true Checks whether the given holiday (short name) is not empty.

비공개 메소드들

메소드 설명
anotherTime ( integer $year, string $shortName ) : Holiday 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.

메소드 상세

__construct() 공개 메소드

Creates a new holiday provider (i.e. country/state).
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

addHoliday() 공개 메소드

Adds a holiday to the holidays providers (i.e. country/state) list of holidays.
public addHoliday ( Holiday $holiday )
$holiday Yasumi\Holiday Holiday instance (representing a holiday) to be added to the internal list of holidays of this country.

between() 공개 메소드

Yasumi only calculates holidays for a single year, so a start date or end date beyond the given year will only return holidays for the given year. For example, holidays calculated for the year 2016, will only return 2016 holidays if the provided period is for example 01/01/2012 - 31/12/2017. Please take care to use the appropriate timezone for the start and end date parameters. In case you use different timezone for these parameters versus the instantiated Holiday Provider, the outcome might be unexpected (but correct).
public between ( DateTime $start_date, DateTime $end_date = null, boolean $equals = true ) : BetweenFilter
$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
리턴 Yasumi\Filters\BetweenFilter

clearHolidays() 보호된 메소드

Clear all holidays.
protected clearHolidays ( )

count() 공개 메소드

Returns the number of defined holidays (for the given country and the given year).
public count ( ) : integer
리턴 integer number of holidays

getHoliday() 공개 메소드

Retrieves the holiday object for the given holiday.
public getHoliday ( $shortName ) : Holiday
$shortName string the name of the holiday.
리턴 Yasumi\Holiday a Holiday instance for the given holiday

getHolidayDates() 공개 메소드

Gets all of the holiday dates defined by this holiday provider (for the given year).
public getHolidayDates ( ) : array
리턴 array list of all holiday dates defined for the given year

getHolidayNames() 공개 메소드

Gets all of the holiday names defined by this holiday provider (for the given year).
public getHolidayNames ( ) : array
리턴 array list of all holiday names defined for the given year

getHolidays() 공개 메소드

Gets all of the holidays defined by this holiday provider (for the given year).
public getHolidays ( ) : Holiday[]
리턴 Yasumi\Holiday[] list of all holidays defined for the given year

getIterator() 공개 메소드

Get an iterator for the holidays.
public getIterator ( ) : ArrayIterator
리턴 ArrayIterator iterator for the holidays of this calendar

getYear() 공개 메소드

Returns the current year set for this Holiday calendar.
public getYear ( ) : integer
리턴 integer the year set for this Holiday calendar

isHoliday() 공개 메소드

Determines whether a date represents a holiday or not.
public isHoliday ( mixed $date ) : boolean
$date mixed a Yasumi\Holiday or DateTime object
리턴 boolean true if date represents a holiday, otherwise false

isHolidayNameNotEmpty() 보호된 메소드

Checks whether the given holiday (short name) is not empty.
protected isHolidayNameNotEmpty ( $shortName ) : true
$shortName string the name of the holiday to be checked.
리턴 true upon success, otherwise an InvalidArgumentException is thrown

isWorkingDay() 공개 메소드

A working day is defined as a day that is not a holiday nor falls in the weekend. The index of the weekdays of the defined date is used for establishing this (0 = Sunday, 1 = Monday, etc.)
public isWorkingDay ( mixed $date ) : boolean
$date mixed a Yasumi\Holiday or DateTime object
리턴 boolean true if date represents a working day, otherwise false

next() 공개 메소드

Retrieves the next date (year) the given holiday is going to take place.
public next ( $shortName ) : Holiday
$shortName string the name of the holiday for which the next occurrence need to be retrieved.
리턴 Yasumi\Holiday a Holiday instance for the given holiday

previous() 공개 메소드

Retrieves the previous date (year) the given holiday took place.
public previous ( $shortName ) : Holiday
$shortName string the name of the holiday for which the previous occurrence need to be retrieved.
리턴 Yasumi\Holiday a Holiday instance for the given holiday

whatWeekDayIs() 공개 메소드

This function returns the index number for the day of the week on which the given holiday falls. The index number is an integer starting with 0 being Sunday, 1 = Monday, etc.
public whatWeekDayIs ( string $shortName ) : integer
$shortName string short name of the holiday
리턴 integer the index of the weekdays of the requested holiday (0 = Sunday, 1 = Monday, etc.)

whenIs() 공개 메소드

On what date is the given holiday?
public whenIs ( string $shortName ) : string
$shortName string short name of the holiday
리턴 string the date of the requested holiday

프로퍼티 상세

$locale 보호되어 있는 프로퍼티

the object's current locale
protected $locale

$timezone 보호되어 있는 프로퍼티

the object's current timezone
protected $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.)
protected $weekend_days

$year 보호되어 있는 프로퍼티

the object's current year
protected $year